Many insects are quite dramatically attracted to artificial light sources. So called 'Phototaxis'.
Moths in particular are (famously) so drawn to light sources that they frequently get burnt in candle flames.
Moths are known to have a visual system that is extremely sensitive in low light conditions - presumably an advantage for nocturnal species. They are also known to migrate using moonlight and windspeed as navigational cues. But a precise, agreed, explanation as to why they circle lamps etc is currently lacking.
“Moths frequently appear to circle artificial lights, although the reason for this behavior remains unknown. One hypothesis to explain this behavior is that moths use a technique of celestial navigation called transverse orientation. By maintaining a constant angular relationship to a bright celestial light, such as the moon, they can fly in a straight line. Celestial objects are so far away that, even after travelling great distances, the change in angle between the moth and the light source is negligible; further, the moon will always be in the upper part of the visual field, or on the horizon. When a moth encounters a much closer artificial light and uses it for navigation, the angle changes noticeably after only a short distance, in addition to being often below the horizon. The moth instinctively attempts to correct by turning toward the light, thereby causing airborne moths to come plummeting downward, and resulting in a spiral flight path that gets closer and closer to the light source.”