Moths are attracted to light due to a behavior called phototaxis, but the exact reason isn’t fully understood. One theory suggests that moths use natural light sources such as the moon for navigation, and artificial lights confuse their navigation system. This causes them to fly toward the light source, often in a spiral pattern.