The greatest question of all is how we came to be. You could solve every problem and question in the world, the question will remain, though. Like many have said, no one knows. Even though I'm Muslim, it's not like I don't think about different ways the Earth came to be, I'm open-minded.
Terrorist.
Anyways, here's the story of just our Earth.
A huge massive start "explodes" or more commonly know as "went supernova" and huge amounts of material that had been built up inside during it's life due to nuclear fusion of atoms, is expanded into a cloud like formation. This formation is called a nebula, one of the most beautiful things in the universe.
After a certain amount of time goes by, a small star begins forming in the nebula, creating a proto-planetary disc. As the star is growing bigger and hotter from all of the materials that are being fused together inside, the materials left outside and around the star begin clumping together. Whether you think Newton was correct or Einstein's space-time fabric, you eventually get bigger and bigger clumps of materials, that form planets, asteroids, comets, and gas giants.
Now, you have to understand that the gas being lighter then other material is getting spread out to the outer regions of the disc that is now spinning faster and faster. This is the reason our gas giants are part of the "Outer Solar System". As these clumps are forming, they are basically clearing out their own orbit trails. Whatever is in their way will just add to the growing size of the planet.
Now, our moon-less Earth which is in the so-called Goldilocks zone, the place that is "just right" in the solar system for organic life, continually spins and begins to cool down, an unexpected incident occurs.
Instead of the 4 inner planets we have today there were still proto-planets circling the sun, and one happened to cross the Earth's orbit trail at just the right time. As it hit the Earth, it didn't have a dead-on shot. It just did something similar to this computer simulation:
This was a defining moment in the formation of our world, and the ability for it to host life on it's surface.
This hit, basically stripped the Earth of it's surface crust, and sent both sets of materials spinning orbiting the planet. While some of it fell back down to the surface, parts began clumping together to form our moon, which is the biggest ratio of moon to planet in the solar system. The reason is because it is basically a whole proto-planet and some other stuff. Another critical thing this did, was it tipped the Earth just so that we have today's seasons. The size of our moon stabilized the axis, and that is why the equator doesn't freeze in the winter.
Without this defining event, our axis would wobble about, killing possible life by rapid season changes.
Another amazing bout of luck was the fact we have a gas giant that hold the asteroid belt together, rather then asteroids flying all around increasing the chance for a deadly collision.
This is all scientific fact, and should be debated by people, not just thrown out as non religious crap.