Various theories have been proposed on the formation of the moon but none explains all the points precisely. The Giant Impact Hypothesis is the currently favored theory on how the moon was formed. It says that the moon was formed about 4.5 billion years ago, a few million years after the formation of the solar system, due to the collision of earth with a planet about the size of Mars.
According to this theory a Mars sized planet once orbited the sun not far away from earth. This early planet has been named Theia, after the Greek titan who gave birth to the Moon goddess, Selene. About 30-50 million years after the solar system began to form, Theia collided with Earth. The collision resulted in Theia being partially absorbed into earth, but a significant amount of debris from both Theia and Earth were sprayed around our planet. Gravity pulled the debris into orbit around earth and as the fragments collided, they began to quickly coalesce together to form today’s moon.
The Giant Impact theory on how the moon was formed is supported by some evidence including: the identical direction of the Earth’s spin and the Moon’s orbit, Moon samples that indicate the surface of the Moon was once molten just like it should have been after the collision, the Moon’s relatively small iron core and evidence of similar collisions in other star systems (that result in debris disks). Also giant collisions are consistent with the leading theories of the formation of the solar system. Finally, the moon has exactly the same oxygen isotope composition as the Earth, unlike other planets in the Solar System, indicating that the moon should have been formed from material in Earth’s neighborhood.
One of the points against the theory is that the energy from such a collision would have produced a global ocean of magma on earth but there is no evidence that earth had such a magma ocean. Other remaining questions include when the Moon lost its share of volatile elements and why Venus, which also experienced giant impacts during its formation, does not host a similar moon.