The phenomenon, which has been studied since 1885 (way before earbuds), goes by such names as stuck song syndrome, sticky music, musical imagery repetition, intrusive musical imagery, or the semi-official term, involuntary musical imagery, or INMI.
www.medscape.com

Song Stuck in Your Head? What Earworms Reveal About Health
Earworms are usually harmless, except when they're not.
