This is a really good question … because scientists don’t really know.
Most planets have Moons, these are usually asteroids or bits of rocky space crap flying around the solar system which are captured by the planets gravity into orbit around the planet to create a Moon.
Our Moon is different. It’s formed from the same material as the Earth. Some people think a giant impact between the Earth and a rocky body left some of the Earth flying off to form the Moon.
There is also a theory that a massive nuclear explosion deep in the Earth, caused by a build up of naturally occurring radioactive material, broke off some of the Earth which created the Moon. I like this one as it’s quite Sci-Fi.
Currently scientists are working on figuring this out though so maybe in a few years we will have a proper answer.