This means that someone is irresistibly and dangerously attracted to something or another person which could lead to a tragic result. This proverb is a simple allusion to the well-known attraction that moths have to bright lights. The word moth was used the the 17th century to mean someone who was apt to be tempted by something that would lead to their downfall. This is referred to by Shakespeare in The Merchant of Venice, 1596:
"Thus hath the candle singd the moath."