The egg came first because a female sex cell is called an egg.
If you mean not that kind of egg, but only the ones with shells, the answer still stands, and you could read
this, or
this, or
this.
Not surprisingly, the Bible gives an opposite, wrong, explanation...