We technically don't know when the moon was formed but scientist guess it was formed 4.5 billion years ago.
Different Theories and Hypothesis
Fission Theory
One theory is that the moon must have broken away from Earth, when the earth was still a rotating ball of molten rock. Earth might have been spinning so fast that part of our planet separated into space, this could be why our chemical composition is similar to the moon. Fission theorist stated that the Pacific ocean might have been the place where the moon material broke off.
Capture Theory
This theory says that the moon was created somewhere else in the milky way, while it was travelling past Earth the moon got trapped in Earth's gravity. That's why it’s