It is a perplexing question; everybody wants to know.
Scientific knowledge on creation of everything, rather most of the things, is but quite recent.
Life started first as living cells. They had no locomotion and other virtues like vision, touch, hearing and all others. They moved in their space with the force of moving water or air where they originated. They grew and gradually achieved newer sensations like touch. This made them to feel any object blocking their smooth movement in the media (air or water) and they change their direction.
Then new such perceptions began to develop in their rudimentary shape of their body. In the process of evolution, involving millions of years, a simple cell developed pseudo pods (simple elongations in the body of these cells). These elongations modified to work like a hand or legs. Similarly developed special sense organs eye, ear and others. Then developed the vertebrates and none vertebrates. In them developed the bodily systems like digestive, urinary, circulatory etc. So also, developed the reproductive system that is needed for perpetuation of the living world. Separation in animal (also in plant world) in sex occurred. Then a system of re union and pregnancy needed. Here only the egg appears.