The egg was formed due to coming together of various organic compounds, inorganic minerals together from atmosphere of Earth and from the material of Earth's crust. The Sun rays, presence of water, temperature could have triggered changes in compounds.
Somehow the egg was formed under favrourable conditions and then evolution occurred with RNA and DNA , inheritance and so on.
The egg grew due to protein and fat content and then animal grew in size. So without egg the animal could not have grown up.