Muggles may very well have beaten wizards to the Moon, and beyond. Space is one of the only acknowledged limitations of magic in the Harry Potter books. The Department of Mysteries in the Ministry of Magic has an entire room devoted to space.
The Space Chamber hosts floating replicas of the planets and minor planets in our solar system. To what end is, of course, a mystery. Their efforts don’t appear to be a space program, as none of the books reference any sort of wizarding expedition beyond planet Earth, aside from a Quibbler article of dubious authenticity.
J.K. Rowling herself has stated that the distance one can apparate is based upon the wizard’s individual skill and the distance of the jump. The longer the apparation and the more inexperienced the wizard, the likelier that death or grievous bodily harm will result. Enchanted broomsticks have similar range issues. A transatlantic flight was seen as a momentous accomplishment back in the 1930s. The geniuses over at Stack Exchange examined the situation in detail and came to the conclusion that neither apparation nor broom-flight could safely convey a wizard to the Moon.
Even for wizards there are less conventional methods of transportation, as the responses to this Reddit post explore. A port key launched on a probe bound for a celestial body is one such solution. Another feasible application of magical aerodynamics is a combination of levitation spells and vanishing cabinets. An earnest redditor brings up fireplace based teleportation through floo powder, but the primary dilemma facing that approach is the lack of fireplaces outside Earth. Or atmospheres for combustion.
You’re not a rocket scientist, Harry.