Chickens love to peck. Normally though they do not peck their own eggs but when it starts and nothing is done to keep them from doing it, they would develop the taste of the eggs and the habit could form. To prevent chickens from eating their eggs, try the following.
Feed your chicken grits. Grits are purchased in your local farm supply store or you could make your own. To make grits, roast eggshells until they are brownish and crunchy. Pound the shells and mix it with chicken feed. Chicken that does not have enough calcium in their diet will try to find it elsewhere and eggshells are an alternative source. Make sure that the feed has enough calcium and protein.
When an eggshell is weak, it could easily break and when it does, the chicken will start pecking on it. Weak eggshells are signs that the chicken lacks Vitamin D3, protein, calcium, or has an infection. Check for infection aside from feed composition.