Four and a halfish million years ago something the size of Mars slammed into the not-quite-finished-cooking-yet Earth and ejected enough debris to eventually form the moon. As my understanding goes, this ejected matter from the impact was drawn together out in space by the force of gravity and was also trapped in orbit around the Earth by its gravity.
Why didn't all that matter just get sucked directly back to the Earth, since its gravity would be so much stronger than the larger moon chunks that were out there at the start, and for that matter why didn't the entire moon get sucked back into the Earth? I don't understand how gravity can cause all that minute debris in space to form together as a new body but not pull that matter into a much larger planet that's right frigging next to it*.
Okay science people, school me.
*Give or take three or four hundred thousand kilometers.