The current prevailing theory is that Mars sized planet name Theia impacted a more massive Earth At the right angle that the seismic waves from the impact ripped off earth's crust and part of the mantle. The Earth had ALREADY chemically differentiated so it had an iron nickel sulfur inner and outer core, a viscous mantle and possibly a solid crust with both basaltic and grantic rocks. that fractionally crystallized.
When Theia impacted at the correct angle and the seismic waves ripped of earth's crust and part of the mantle all of that debris became molten magma again because of the energy of the impact.. SOME of the debris formed a ring around Earth similar to Saturn's' , Jupiter's Uranus' and Neptune's rings Inside Earth's fluid Roche limit. in about 10,000 years that debris slammed together and stuck together and coalesced and become the Moon, which then chemically differentiated so it is has an iron nickel sulfur inner and outer core , which is still has 30 km thick liquid outer core, , titanium rich mantle and crust with basaltic and silic aluminum anorthosite rocks.
We donot KNOW EXACTLY how the Earth or Moon formed. it's not like we can rewind the tape and watch the Sun , planets and moons AND the Moon forming by playing that tape fast forward. Human beings DID NOT exist.
Yes I CAN provide sources, but I am only going to add two or three sources. it's taken a considerable amount of time to compose this answer. if you want more, you will need to politely request I add more sources, and I may not see an update to your if you update your question.. This is probably the on detailed answer you will get.
https://en.wikipedia.org/wiki/Stellar_nu...
https://en.wikipedia.org/wiki/Fractional...
https://en.wikipedia.org/wiki/Roche_limi...
Apparently YA will NOT upload .GIF format images.
-