The slot machine was invented by Charles Fey (1862-1944) in 1895, in the basement of his San Francisco home. While similar mechanical games of chance existed prior to Fey's invention, none of them could dispense a prize without the involvement of an attendant. Initial public reaction to his test machines was strong enough to motivate Fey to quit his job as a partner in an electrical supply business and focus entirely on slot machines. By 1896, his factory was up and running in San Francisco. Fey's company produced their first three-reel model, the Liberty Bell, in 1898. In 1901, he created a poker slot machine that played five card draw. In 1929, after significant effort to address the mechanical challenges presented by larger coins, he created a silver dollar slot machine, which was a quite popular with speakeasy saloons.

When gambling devices were prohibited, slot machines were adapted to dispense candy or chewing gum instead, which originated the use of cherries, lemons, and other fruit symbols on the reels.

In the early days of Las Vegas, slot machines were not thought of as the cash cow that they are today. Most casinos started stocking slot machines strictly as an amusement to appease the bored wives of gamblers, allowing the men to spend more time gambling before their wives would drag them away from the tables. As the decades passed, casino owners started to see the low operating cost and high profit potential for slot machines, and would dedicate more and more casino floor space to a machine that was previously considered a mindless, idle distraction.

Advances in computer technology made slot machines more tamperproof (for the most part), as well as easier for the casino to manipulate, but less is known about the psychological research that continues to drive the design of the games. Details like the colors of the machine, the sounds it makes, and the size of the payouts are no longer arbitrary decisions, thanks to tireless behavioral research. Red and gold are used much more often than blue light, which can make a person look tired or sick, musical tones are always played in the key of C major to avoid sounding dark or clashing with the sounds of other machines nearby, and payouts are small, frequent, and random occurrences, straight out of the operant conditioning and behavior shaping theories of B.F. Skinner. Factors that are less universal, like the perceived luckiness of certain specific numbers, are also involved in the design of machines around the world.