An earworm is a very short piece of music which the mind involuntarily plays on certain triggers. For example, I hear the city name, Exeter, and a snatch of Bob Marley's Exodus plays in my head. Here's how the august British Psychological Society explain the phenomenon.
The brain has its own jukebox. A personal sound system for your private listening pleasure. The downside is that it has a mind of its own. It often chooses the songs and it frequently gets stuck, playing a particular tune over and over until you're sick of it. Psychologists have nicknamed these mental tunes "earworms" (from the German Ohrwurm). A study from 2009 found that they can last anywhere between minutes to hours, but that they're only unpleasant in a minority of cases. SourceThis BBC radio documentary takes a playful look at research into earworms