There are a number of theories about where the moon came from.Our best guess is that it was formed when earth was hit by a large object called Theia.The impact threw up huge amount of debris that coalesced to form moon.
There is a problem with this theory.The mathematical models show that the most of the material of moon should come from theia,but models from Apollo missions show that most of the material of moon came from earth.
A paper our earlier this week in Nature Geoscience has a possible explanation.The research led by Natsuki Hosono from Japan agency for Marine-Earth Science and Technology ,suggest that Earth at time of impact was covered in hot magma rather than hard outer crust.
Magma on planetary surface could be lodged much more easily than solid crust,so it’s plausible that when the Theia struck the Earth,molten material originating from earth flew up into space and hardened to form moon.This theory relies a lot on timing of formation of moon.