Moths are attracted to a single direct accessible light source, such as a lamp or torch, as opposed to the sun which dissipates its light over a massive area and distance, thus providing no real contrast to the surrounding darkness. That's an 'educated' guess, but it sounds reasonable to me - feel free to argue, if anyone knows a more scientific answer.