The origin of our Moon has long been a mystery. Although there are 3 plausible theories, they rely on knowing about what the Moon is made from.
It was not until samples of the Moon were brought back during the NASA Apollo missions in the 1960s and early 1970s that one theory became most likely.
There are 3 likely theories as to how the Moon formed:
Formation of the Moon from the debris of a giant impact.
The Apollo missions brought back over a third of a tonne of rock and soil from the Moon. Analysis of this material revealed that it was similar, but not quite the same as rock from Earth.
If the Moon had been created elsewhere and was captured by the Earth's gravity we would expect its composition to be very different from the Earth's.
If the Moon was created at the same time, or broke off the Earth, then we would expect the type and proportion of minerals on the Moon to be the same as on Earth. But they are slightly different. For example, the minerals on the Moon contain much less water than similar terrestrial rocks. The Moon is also rich in material that forms quickly at high temperature.
This suggests that the impact theory is the most plausible.