it is 384,000 km from the earth to the moon but in order to leave the earth and approach the moon safely a spacecraft would not travel on a straight line. As Shane says above Neil Armstrong’s Apollo 11 mission took 3 days and 3 hours to get to the moon. Later missions were much faster. It all depends on the flight plan of each mission.
A beam of light on the other hand would only need just above 1.25 secs to travel the distance!