Why do moths fly towards lights?

Im sitting here getting annoyed at a moth that keeps flying past my light and making wierd shadows on the screen and it got me wondering why moths are attracted to lights... I know people say it is because they think its the moon but why would a moth's instincts tell it to fly towards the moon anyway?
6 answers 6