A moth is a type of insect animal originating from planet Earth, although otherworldly variations have also been recorded. The moth has a tendency to fly towards sources of light and heat as a matter of animal instinct, sometime dooming these creatures to die as they get too close to flames or other energy sources.
When the USS Surak was flown into a star and destroyed to contain the doomsday bug virus, Rear Admiral James T. Kirk's accompanying log entry likened the starship's fate to a moth consumed by a flame. (TOS - The Doomsday Bug! comic: "Death Ship!")
Two-dimensional creatures encountered by the USS Enterprise-D were blindly drawn towards a cosmic string, leading Counselor Deanna Troi to liken the situation to a moth's attraction to flame. (TNG episode: "The Loss")