Nobody can pin down a single inventor — the answer depends on where you draw the line.
As early as 1837, Charles Babbage realised that his never-finished Analytical Engine, designed to handle any mathematical function, could in principle play simple games like tic-tac-toe and chess.
The Nimatron, built by Edward U. Condon in 1940, played the ancient Chinese game of Nim and displayed the action "visually" through columns of lightbulbs. It was shown at the New York World's Fair that year and played by some 50,000 people.
OXO, written by Alexander S. Douglas for the EDSAC computer in 1952 as part of his Cambridge PhD on human–computer interaction, was the first game rendered on an actual display.
Spacewar!, created by Steve Russell in 1962 for the PDP-1, was the first game written for an existing system — and, because its source code was freely shared on request, the first to be distributed.
In 1971, Computer Space by Nutting Associates became the first commercially sold coin-operated video game, built by Nolan Bushnell and Ted Dabney, who would go on to found Atari. A year later, Ralph H. Baer's Magnavox Odyssey became the first home console sold to the public.