Most people have some vague awareness that it first came from the spam skit by Monty Python's Flying Circus. In the sketch, a restaurant serves all its food with lots of spam, and the waitress repeats the word several times in describing how much spam is in the items. When she does this, a group of Vikings in the corner start a song:
"Spam, spam, spam, spam, spam, spam, spam, spam, lovely spam! Wonderful spam!"
Until told to shut up.
Thus the meaning of the term at least: something that keeps repeating and repeating to great annoyance. How did the two get connected?