Is a game the best way to learn or stay mentally sharp? Not when taken at face value, but after a long day of work most people can't sustain something like taking an online course. Playing games can be a good way to stay mentally active when the likely alternative is watching TV or browsing Reddit every night. You'll find studies on cognitive effects of gaming are highly dependent on the games used and the control conditions they were being compared to.
Can’t see how chess would help much in “guess the next number”-type IQ tests. Chess at a certain level requires a very specific sort of pattern recognition that doesn’t really transfer. Sharp people do gravitate towards chess, and it is wonderfully egalitarian (cheap/ubiquitous) and culture-neutral.
Take Factorio, as a for-instance. Intended or not (I've never read what the creators themselves thought about when making the game), it does, if someone pays attention, end up teaching the player both how to apply logic and some understanding of systems theory and basic operations research (optimizations). In particular, trying to manage the flow of objects (much like a real factory) through various points and the assembly/processing time. Now, are people sitting down and ending up with a basic understanding of operations research in a technical sense? Probably not, but in an intuitive sense, I'd wager that most come away with something.
Kerbal Space Program is another game that actually does end up forcing players, short absolute brute force like I've seen some people pull off, to consider the rocket equation and orbital dynamics (even if simplified). It spawned multiple series of YouTube videos teaching people higher level math and physics topics.
Human Resource Machine and 7 Billion Humans (second a sequel to the first), can't really be brute forced. You have to learn some semblance of programming skills in order to complete all the challenges, short of cheating and finding solutions online. I suppose someone could try every program permutation and never learn anything, but they'd probably not have finished level 2 or 3 even if they started with the games when they were released.