The current scientific consensus is that the Moon was formed from the debris of a collision between the proto-Earth and a Mars-sized planetesimal, known as the giant impact hypothesis or Theia Impact, approximately 4.5 billion years ago in the Hadean eon.
...and that the just the right amount of material was ejected from the earth and it wound up at just the right distance. All seems highly improbable....