I've got a novel theory for this. I think it's probably a misappropriation of one of our basic instincts. In this case it's our basic instinct for exploration and innovation which is stimulated. But why do we get pleasure from playing games and, for that matter, why do we get pleasure from exploration and innovation? Well in the real world exploration and innovation are dangerous. If you are living in a safe little enclave with reasonable food supplies it's foolhardy to venture over the mountains looking for somewhere new to live.
But here's the rub, although in the short term living the safe life is optimum in the long run it may not be. Taking risks and innovating is one of the key reasons humans have become so successful as a species. It's how we've survived famines, epidemics and global catastrophes because our ancestors were prepared to take risks when times were good to learn the knowledge required to see them through the bad times.
But what makes us want to take risks when life is comfortable? Well nature has equipped us with pleasure centres in the brain which respond to a variety of stimulus including sex, good food and learning. We get pleasure from learning because it's programmed into us for the reasons just given. This pleasure compensates for the risks required to attain knowledge and if it wasn't our ancestors wouldn't have taken the risks, those genetic traits would have died out, and we'd be extinct as a species by now. So it follows that evolution has made us into a race of risk takers because risk taking is an essential part of our genetic make up. Of course not all of us like taking risks, that would also be bad for our genes, but a lot of us do (and coincidentally it seems men in particular enjoy taking risks).
So how does this fit into games? Well games take place in virtual worlds. We can take risks in our virtual worlds, learn new things, but without the physical risks associated with the real world. Of course the new things we learn often have very limited benefits outside of the game, for example breaking pots at home has rarely furnished me with extra health, but our instincts are not sufficiently sophisticated to notice this. So we blithely carry on learning new, essentially useless things, but getting huge amounts of pleasure doing it.
In many ways I think it's very similar to masturbation. Sex is also dangerous in the real-world, finding a mate, wooing her and settling down to start a family is a huge commitment and entails a great deal of risk for both parties. How does nature compensate for this risk and encourage animals to procreate? By rewarding us with pleasure when they have mate. But unfortunately for nature, humans, and quite a few other animals, have discovered they can get a lot of the same pleasure through masturbation and without the complication and expense of finding a mate.
So you see when you are busy building castles in Minecraft or hunting down that illusive loot in World Of Warcraft or taking that head shot in COD what you are really doing is cheating your instincts by tickling those difficult to reach pleasure centres without taking the associated risks. Games provide us with a way to take risks without really risking anything.