To try to go for a philosophical answer - why do we do anything? Cooking, writing, building shelter, sending spaceships to mars. I think generally, the purpose is to make human brains feel good. Ultimately, we all are going to die and nothing we do will have a lasting impact, but as long as we're here - we spend our time making ourselves and each other feel good. Games are one of the ways to make people feel good.
A more cynical answer - we make games for no good reason. Games feel good in the moment, but feel like a waste of time and energy afterwards, making a net negative impact on people's lives, like junk food or addiction. People play them against their best interests, because it feels good in the moment, and because people aren't rational creatures. People make games because making games is fun and makes them money.
One more answer - making games is art. Art is cool. Making games is an art that can be beautiful, interactive, engaging. It's a combination of multiple art forms (painting, sculpting, storytelling, music, etc). It's also way more fun than most kinds of art, people don't get addicted to paintings or books the way they get addicted to video games. I doubt that people got as much joy out of looking at Mona Lisa as they did out of playing Minecraft.
One more related thought - the real world is overrated. We have the power to make imaginary worlds that are far more engaging and satisfying than the one where we live. Better ones. So we make them.
These are different possible perspectives, pick yours. There can be a bunch more I'm not considering.