In the early solar system, 4.5 billion years ago, the planets were still coalescing, something enormous hit the Earth.
After it formed, huge impacts shaped the surface of the moon into what we see today. NASA takes up the story:
These videos are awesome introductions to the early history of the Earth, Moon, and solar system.