This is one of the main subtexts of Metal Gear Solid 2, as the game shows exactly what the players who wanted to be Solid Snake would have to go through with Raiden.
Calypso, from the Twisted Metal games. He grants the winners of his competitions their wishes in a manner that either kills them or results in an outcome different from what they had envisioned. A case of the former in Twisted Metal: Head-On is when the driver of Spectre, Chuckie Floop, wished for a lot of money and was then buried alive underneath a massive pile of cash. In Warthog's ending for Twisted Metal 2, Calypso delivers a sickeningly brilliant example of the latter when he grants the 105-year-old Captain Rogers' wish for a youthful body ... sans the head to match.
Occasionally, Calypso will grant a wish straight, only for the winner to experience the inevitable or natural consequences of their wish.
And for all his trickery, Calypso has indeed suffered a reversal of this (Sweet Tooth in Twisted Metal: Black).
Most of the "bad" endings in S.T.A.L.K.E.R.: Shadow of Chernobyl consist of this, with the player character succumbing to the temptation to make a wish to the mysterious artifact in the middle of Chernobyl (the wish chosen depending on certain conditions). All of these wishes end up backfiring on him:
"I want the Zone to disappear": the PC goes blind
"Mankind is corrupt, it must be controlled[1]": Images of war and death start flashing followed by the PC standing in a black void
"I want to be rich": the PC sees gold coins falling from the sky...which turn out to be an hallucination: the "coins" are actually bolts falling from the ceiling which collapses on the PC, killing him.
"I want to rule the world": the PC is absorbed into the C-Consciousness.
"I want to be immortal": the PC is turned into a metal statue.
In Baldur's Gate II: Throne of Bhaal you get the wish spell. It's a hell of a lot more powerful than the limited wish spell and also level 9. It's also extremely tricky to cast, as the Djinn that you summon is a grumpy so-and-so who's out to get you and as such you will need a very good Wisdom score to be able to handle him okay. A WIS of 18 is nigh-on essential to get the most out of this spell, and anything under 9 WIS is catastrophic. When you cast the spell, time is stopped and the casting character negotiates with the Djinn for some hours - finally he presents you with "a list of 5 ways I can interpret your wish - choose one".
The conditions on wish and limited wish even at very high Wisdom can make them a prime example of a Useless Useful Spell. For example, asking to be protected against the undead will make it summon a horde of vampires to attack you so that there are some undead to be protected against, then not protecting you from them. This isn't Literal Genie twisting of words, it's just... not doing the thing you asked in any way.
Only because you got the wording of that wish wrong. It was "prepared against undead". And you do need undead to be prepared against. In the wishes where you ask for protection, you get it. Of course, if you ask to be immune to magic, you probably forgot that healing and buffs are magic also... Another example is if you for a horde to overrun your enemies, you never specified what horde and you get a horde of rabbits. It is a combination of stupidly open-ended wishes and a Literal/JerkassGenie
A major concept behind the Game of Afterlife by LucasArts. This is even billed as rule #1 of the afterlife. Specifically, it's stated that souls are treated differently after death based on what they believed in while living.
Planescape: Torment utilizes a classic and particularly chilling incarnation of the trope. An NPC named Yves Tale-Chaser will trade stories with the Nameless One and his companions. One of them begins with a man who comes to in an alley, remembering nothing. An old woman is in front of him, and she asks, "And your third wish?" He says he doesn't understand, and she explains she had offered him three wishes, and he'd already used two - and the second wish was to undo and forget his first wish. So, for the third, he asks to know who he is. She cackles softly as she prepares to grant his wish, and he asks what's so funny. "That was your first wish." It's heavily implied in another part of the game that this actually occurred between the Nameless One and the Night Hag Ravel Puzzlewell.
Eternal Darkness has this happen once. Bored Cambodian temple dancer Ellia finds herself all alone with nothing but what she thinks is an innocuous book of legends to entertain herself, wishes that something exciting would happen to her, and ends up immediately getting locked inside the temple, finding herself entangled and directly involved in the book's "legends," and killed as a result of all this. Now, was that exciting enough for you, Ellia?
It's actually worse than just that. She is turned into a zombie-like husk of a person (still alive) who has to wait until a second hero arrives to undo her mistake. For reference, Ellia's chapter takes place in 1150. That second hero who puts her out of her misery? He arrives in 1983.
There's a wish-granting Mana (the main character) in Mana Khemia: Alchemists of Al-Revis. The first wish it ever granted was death, although, in a subversion, that wish was exactly what the person who wished it was asking for.
In Jak and Daxter, the Precursors offer to turn Jak into one of them as thanks for his services. All of a sudden Count Veger arrives with a gun demanding that HE be turned into one instead. The Precursor says "Be Careful What You Wish For" and does something to Veger. Shortly afterwards it's revealed that the Energy Being they were talking to was just a hologram and that the Precursors...are ottsels. Cue Karmic Transformation when Veger realizes the implications of this.
Later, Daxter, finally in peace with his ottsel appearance, asks for a set of pants. His girlfriend then says that those pants are so cute, she wished she had a pair of them herself. Cue the precursors' "Be Careful What You Wish For" a second time, and the girl getting a pair of pants just like that... and turned into an Ottsel so she could fit into them.
To clarify: In Nethack, it is possible to be granted a wish. A common choice is to wish for a blessed Archon figurine, which when used has an 80% chance of netting you an extremely powerful pet. There is, however a 10% chance that it will instead be generated hostile. Have a Nice Death!
The plot of Final Fantasy Tactics Advance. The protagonists were bullied and disabled children who wished to live in the world of their favorite game, Final Fantasy, to escape their bleary daily life, and the wish comes true. Now they can live in a world where their real life shortcomings have disappeared and have a fun, adventure-filled life! Except that, as Marshe soon discovers, the fantasy world is basically fueled by evil and the longer he and his friends stay there, the longer the possibility that both their original world and this fantasy one get destroyed.
Persona 2: Innocent Sin puts a spin on this. You don't so much have to be careful what you wish for, as be careful about wishing at all. Having your wildest dreams handed to you without struggle or effort will eventually rob you of your ideal energy, causing you to fade away to nonexistence.
This was the case on the production level for Left 4 Dead 2. Valve is notoriously known for their Valve Time due to how long they take to produce games in order to perfect them and/or delaying games after they get close to a release date. People got sick of Valve taking too long to produce anything, so Valve made Left 4 Dead 2 nearly one year after the first game was released in order to prove to people that they CAN release on time and on a fixed schedule. While Left 4 Dead 2 was generally well received, the more dedicated fans complain to this day about random bugs and balance issues with some people stating Valve Time is actually a good thing and Valve should not be rushed.
Similarly, corner camping became a huge issue in Left 4 Dead 1; it was a technique used by survivor players where they huddle in a corner or in a closet and mow down all infected that came their way. People complained about the exploit and started to make suggestions to counter corner camping, which Valve implemented for Left 4 Dead 2 with new infected that dealt with survivors that holed up in a spot (Spitter, Charger, and Jockey), allowing common infected to rush in from more places, and included gauntlet crescendos where survivors have to keep moving through a never ending horde and stop the source (such an an alarm). This worked too well since now most survivor players will always rush the maps and hardly stop, making it difficult for zombie players to be able to spawn in time or attack effectively. Naturally, people are complaining about the changes and want even more special infected that has the ability to stop a survivor from running.
In The Elder Scrolls V: Skyrim, the Daedric Prince Clavicus Vile is essentially this trope given corporeal form. The cave in which you find his shrine is populated with vampires that wished for an end to their suffering, which they presumably thought meant a cure for vampirism. He gave them a heavily armed adventurer. Vile sends you after the Rueful Axe, which he granted to a wizard who wished to end his daughter's lycanthropy.
Discussed in detail in Fate Stay Night, but for the most part averted. Except for Archer. I want to save everyone! I know, how about I make a contract with the world? Guardian Spirits gets to save people all the time! Oh wait, they actually kill people en masse indiscriminately to prevent them from killing even more people. Woops. Other than that little mistake, it seems the idea is 'do what you can with your own ability, and accept your own failures if it doesn't work.
One of the side stories in Kagetsu Tohya has Shiki living in a world based on Twin Threesome Fantasy fantasy scenario he had. The problem is, he realized such a thing could never happen unless they were in a world all by themselves plus he's currently already trapped inside a Groundhog Day Loop. So the Dream Within a Dream he has just traps him a world where he's living forever inside the mansion grounds with only Kohaku and Hisui, doing whatever he likes with them while slowly going insane.