Because people wanted something to do, and the technology happened to be there.
The earliest interactive electronic games were built by researchers and engineers who had access to machines nobody else did. Titles like OXO and Tennis for Two were demonstrations as much as games: they proved that a computer could respond to a person in real time, which was genuinely novel in the 1950s. Pong, a decade later, was the first version of the idea designed explicitly as a commercial product.
So the honest answer is a mix of curiosity and showmanship. The entertainment came first, and the enormous industry followed from it.