How did an old trademarked name for a canned meat develop the sense of "unsolicited, usually commercial e-mail sent to a large number of addresses"? Popularity, technology, and comedy.
Back in the 1930s, Hormel Foods held a contest to name its new luncheon meat. The winning contestant (the brother of a Hormel Foods vice-president) dubbed the spiced ham Spam.
Spam was a hit. By the end of WWII, 100 million pounds of it had been sent to allied troops.
Then, in 1970, the British comedy troupe Monty Python's Flying Circus performed a sketch in which the dialogue, mostly about Spam, is obscured by the chanting ("Spam, Spam, Spam, Spam") of Vikings.
Inspired by that relentless chant, early e-mail users bestowed the word on the growing clutter in their in-boxes.