The Bacon Number was inspired by Six Degrees of Kevin Bacon, a popular parlor game that was based on the assumption that any actor could be linked to Kevin Bacon in 6 steps via their roles. Wikipedia details its origin:
In a January 1994 Premiere magazine interview about the film The River Wild, Kevin Bacon commented that he had worked with everybody in Hollywood or someone who's worked with them. On April 7, 1994, a lengthy newsgroup thread headed "Kevin Bacon is the Center of the Universe" appeared. The game was created in early 1994 by three Albright College students, Craig Fass, Brian Turtle, and Mike Ginelli. According to an interview with the three in the spring 1999 issue of the college's magazine, The Albright Reporter, they were watching Footloose [starring Bacon] during a heavy snowstorm. When the film was followed by The Air Up There [another Bacon movie], they began to speculate on how many movies Bacon had been in and the number of people he had worked with. "It became one of our stupid party tricks I guess. People would throw names at us and we'd connect them to Kevin Bacon."
The trio wrote a letter to talk show host Jon Stewart, telling him that "Kevin Bacon was the center of the entertainment universe" and explaining the game. They appeared on The Jon Stewart Show and The Howard Stern Show with Bacon to explain the game. Bacon admitted that he initially disliked the game because he believed it was ridiculing him, but he eventually came to enjoy it.
The whole thing is an homage to 'six degrees of seperation', the theory that every person is connected to any other person by 6 steps or less. The three college students picked Bacon to illustrate the theory in the world of film because, as specified above, they realized he was in a lot of things. Happenstance made it about Bacon and not about some other prolific actor, and it was fun enough to become viral.