It comes from the Monty Python sketch.
This is from Wikipedia
In the 1980s the term was adopted to describe certain abusive users who frequented
BBSsand
MUDs, who would repeat "Spam" a huge number of times to scroll other users' text off the screen.
[8] In early chat-room services like PeopleLink and the early days of Online America (later known as America Online or AOL), they actually flooded the screen with quotes from the Monty Python Spam sketch.[
citation needed] This was used as a tactic by insiders of a group that wanted to drive newcomers out of the room so the usual conversation could continue. It was also used to prevent members of rival groups from chatting—for instance,
Star Wars fans often invaded
Star Trek chat rooms, filling the space with blocks of text until the Star Trek fans left.
[9]
It later came to be used on
Usenet to mean excessive multiple posting—the repeated posting of the same message. The unwanted message would appear in many, if not all newsgroups, just as Spam appeared in all the menu items in the Monty Python sketch. The first usage of this sense was by
Joel Furr.