Portal's plot is revealed to the player via audio messages or "announcements" from GLaDOS and visual elements inside rooms found in later levels. According to The Final Hours of Portal 2, the year is established to be "somewhere in 2010"—twelve years after Aperture Science has been abandoned.
The game begins with Chell waking up from a stasis bed and hearing instructions and warnings from GLaDOS, an artificial intelligence, about upcoming tests. Chell enters into distinct chambers that introduce players to the game's mechanics, sequentially. GLaDOS's announcements serve as instructions to Chell and help the player progress through the game, but also develops the atmosphere and characterizes the AI as a person. Chell is promised cake as her reward if she completes all test chambers.
Chell proceeds through the empty Enrichment Center, with GLaDOS as her only interaction. As the player nears completion, GLaDOS's motives and behavior turn more sinister; although she is designed to appear encouraging, GLaDOS's actions and speech suggest insincerity and callous disregard for the safety and well-being of the test subjects. The test chambers become increasingly dangerous as Chell proceeds, tests including a live-fire course designed for military androids, as well as some chambers flooded with a hazardous liquid. In another chamber, GLaDOS notes the importance of the Weighted Companion Cube, a waist-high crate with a single large pink heart on each face, for helping Chell to complete the test. However, GLaDOS declares it must be euthanized in an "emergency intelligence incinerator" before Chell can continue. Some later chambers include automated turrets with childlike voices (also voiced by McLain) that fire at Chell, only to sympathize with her after being destroyed or disabled.
After Chell completes the final test chamber, GLaDOS maneuvers Chell into an incinerator in an attempt to kill her. Chell escapes with the portal gun and makes her way through the maintenance areas within the Enrichment Center. GLaDOS panics and insists that she was pretending to kill Chell as part of testing. GLaDOS then asks Chell to assume the "party escort submission position", lying face-first on the ground, so that a "party associate" can take her to her reward, but Chell continues her escape. In this section, GLaDOS communes with Chell as it becomes clear the AI had killed everyone else in the center. Chell makes her way through the maintenance areas and empty office spaces behind the chambers, sometimes following graffiti messages which point in the right direction. These backstage areas, which are in an extremely dilapidated state, stand in stark contrast to the pristine test chambers. The graffiti includes statements such as "the cake is a lie", and pastiches of Emily Dickinson's poem "The Chariot", Henry Wadsworth Longfellow's "The Reaper and the Flowers", and Emily Brontë's "No Coward Soul Is Mine", referring to and mourning the death of the Companion Cube.
GLaDOS attempts to dissuade Chell with threats of physical harm and misleading statements as Chell makes her way deeper into the maintenance areas. Chell reaches a large chamber where GLaDOS's hardware hangs overhead. GLaDOS continues to threaten Chell, but during the exchange, a sphere falls off of GLaDOS and Chell drops it in an incinerator. GLaDOS reveals that Chell has just destroyed the morality core or her conscience, one of the multiple "personality cores" that Aperture Science employees installed after the AI flooded the enrichment center with neurotoxin gas. With it removed, she can access its emitters again. A six-minute countdown starts as Chell dislodges and incinerates more of GLaDOS' personality cores, while GLaDOS discourages her both verbally, with taunts and juvenile insults, and physically by firing rockets at her. After Chell destroys the last personality core, a malfunction tears the room apart and transports everything to the surface. Chell is then seen lying outside the facility's gates amid the remains of GLaDOS. Following the announcement of Portal 2, the ending was expanded in a later update. In this retroactive continuity, Chell is dragged away from the scene by an unseen entity speaking in a robotic voice, thanking her for assuming the "party escort submission position".
The final scene, after a long and speedy zoom through the bowels of the facility, shows a Black Forest cake, and the Weighted Companion Cube, surrounded by a mix of shelves containing dozens of apparently inactive personality cores. The cores begin to light up, before a robotic arm descends and extinguishes the candle on the cake, causing the room to blackout. As the credits roll, GLaDOS delivers a concluding report: the song "Still Alive", which declares the experiment to be a huge success, as well as serving to indicate to the player that GLaDOS is still alive, that her "happy" core was not disabled.