The origin of video games is often told in a simple, almost accidental way: someone tinkering in a lab got bored, rigged up a bit of equipment with a big machine, and started playing with it. It turned out to be fun, and just like that, the idea of a playable electronic game was born.
The real history is a bit more involved, stretching back to early experiments like the Nimatron and OXO, but that playful spirit of experimentation is genuinely at the heart of how games came to be.