Eggs were around long before there were chickens. In addition to birds, mollusks, fish, insects, frogs, reptiles, and even some mammals lay eggs. These mammals are known as monotremes. The closest living relatives of birds include crocodiles, lizards, snakes, and turtles, all of which lay eggs with soft shells. Birds have evolved a hard-shelled egg to protect the egg from breaking or drying out as the chick develops.
Laying eggs instead of giving birth to live young has several advantages for birds. Eggs are heavy and, in most species, the female lays more than one egg. These would be too heavy for the female bird to carry around inside her body as they developed if she were to give birth to live young. Also, laying eggs allows the male bird to help with caring for the eggs.