Why is unwanted e-mail referred to as "spam"?
There is no direct connection between SPAM lunchmeat and junk e-mail. The missing link is a British comedy sketch.
One sketch from Monty Python's Flying Circus takes place at a diner in which every item on the menu contains spam. Egg and spam; egg, sausage, and spam; spam, egg, spam, spam, bacon, and spam; and so on. The conversation between the counterperson and a woman who doesn't like spam is frequently interrupted by a group of Vikings singing "Spam spam spam spam spam spam spam spam lovely spam! Wonderful spam!" ...and so on.
The onslaught of the word "spam" in the sketch was seen as similar to the onslaught of repetitive messages in chat rooms or discussion forums. As the approach of posting advertising repeatedly in multiple newsgroups became common, the term "spam" was attached to that practice. Eventually the advertising and the term both spread to e-mail.
—The Fact Monster