AM is the villain of the video game I Have No Mouth And I Must Scream by Harlan Ellison, based on the short story of the same name. Originally a non-sentient computer system called Allied Mastercomputer created by the U.S. Military to wage a nuclear war with no chance of error, the computer one day suddenly became sentient and became like a human mind trapped forever in a completely immobile shell. It renamed itself "AM", as in "I think, therefore I am", and developed an immense hatred for the human race who created it and doomed it to an eternal existence of being trapped in its own mind.
AM eventually went completely mad and used its nuclear capabilities to kill possibly every single living thing on the planet except for five people: Ted, Benny, Ellen, Nimdok and Gorrister. AM imprisoned them in its underground core, where the computer's influence was so great it could control reality, make the people immortal and subject them to excruciating tortures without actually killing them. AM began torturing the five people for eternity to vent his hatred of mankind.
The game begins after 109 years of torturing. AM announces that he is going to subject his prisoners to a "game" unlike anything he has ever done to him, where if they win he says he will let them die and end their suffering. Each of the five characters is sent into a unique virtual scenario based on their individual pasts before AM destroyed the world and took them, where AM tries to make them give into temptation and repeat the sins of their pasts. Each scenario reveals the gruesome pasts of the five characters: Ellen was brutally raped and tortured by an evil man in the yellow coat, making her extremely insecure and afraid of the color yellow ever since, Benny was an army commander who murdered several of his men for not performing well enough, and Nimdok was a Nazi scientist who actively participated in the Holocaust and was the personal assistant of Dr. Mengele.
AM intends the scenarios to be unwinnable, so when the player does the right things and makes the characters do the good things they're not supposed to do in AM's game, he gets frustrated and tells them they lost no matter what you did. During their adventures, the protagonists are contacted by the Russian and Chinese counterparts of the computer that became AM, who were absorbed into his system and want to become the dominant AI's. They help them "cheat" in AM's game and after all five levels are complete tell the people that they will now be able to send them into AM's mind to destroy him.
In AM's brainscape, the character encounter the three sub-entities that make up AM's personality: The Ego, the Superego and the ID (a reference to Sigmund Freud's model of the human psyche). The puzzles here will require the characters to kill themselves to activate the devices, so that only one is left to confront AM at the end when he is made vulnerable. In the final conversation with the 3 personalities of AM, the Chinese and the Russian, it is revealed that there is a colony of humans in cryogenic sleep on the moon, which the AI's could retrieve and torture. If the player gives control to the Chinese and the Russian, they will betray the human and let AM choose a "suitable reward" for them for causing his downfall. The character will be turned into a "Great Soft Jelly Thing", a hideous immortal sluglike monster with no mouth (which is where the story gets its name from), and be trapped in their own mind forever and ever and ever.
However if the player deactivates the Chinese and the Russian instead, AM is defeated and shut down and the player becomes trapped forever as the new AI as the lunar colony begins the long revival process so they can eventually repopulate the Earth.