While some of the details are still being worked out, it's generally agreed that the Moon formed when a Mars-sized body collided with the early Earth. Some of the debris put into orbit by the collision would then go on to condense into the Moon.
One of the consequences of this is that the early Moon spent a lot of its history being bombarded by this debris, a process that should have left its surface molten. This magma ocean would only solidify slowly as the bombardment wound down, and the process of solidification should have left a mark on the Moon's composition. So far, indications of this have been difficult to come by. But now, there are signals that the Chang’E-4 mission to the Moon's far side has finally spotted some of the Moon's mantle, which contains signs of its magma ocean.
The end of an ocean
At first glance, the end of a magma ocean might seem simple: molten rock solidifies, leaving behind a solid body. But different minerals have their own melting points and densities, which can cause the ocean to become stratified. Ultimately, it's thought that the densest minerals will solidify at the base of the ocean, while the crust would be formed from lighter material that could solidify while floating on top of the remaining magma. Thus, we'd expect to see certain minerals on the surface and a different group of minerals deep in the mantle.