John Murdoch (Rufus Sewell) awakens in a hotel bathtub, suffering from amnesia. He receives a phone call from Dr. Daniel Schreber (Kiefer Sutherland), who urges him to flee the hotel to evade a group of men who are after him. During the phone talk, Murdoch discovers the corpse of a brutalized, ritualistically murdered woman, along with a bloody knife. He flees the scene, just as the group of men (known as the Strangers) show up to investigate the room.
Eventually Murdoch learns his own name, and finds he has a wife named Emma (Jennifer Connelly). He is also sought by police inspector Frank Bumstead (William Hurt) as a suspect in a series of murders committed around the city, though he cannot remember killing anybody. While being pursued by the Strangers, Murdoch discovers that he has mind powers—which the Strangers also possess, and refer to as "tuning"—and he manages to use these powers to escape from them.
Murdoch explores the city, where nobody realizes that it is always nighttime. At midnight, he watches as everyone except himself falls asleep as the Strangers stop time and physically rearrange the city as well as changing people's identities and memories. Murdoch learns that he comes from a coastal town called Shell Beach, a town familiar to everyone, though nobody knows how to leave the city to travel there, and all of his attempts to do so are unsuccessful for varying reasons. Meanwhile, the Strangers inject one of their men, Mr. Hand (Richard O'Brien), with memories intended for Murdoch in an attempt to predict his movements and track him down.
Murdoch is eventually caught by inspector Bumstead, who acknowledges he is innocent, and by then has his own misgivings about the nature of the city. They confront Dr. Schreber, who explains that the Strangers are endangered extraterrestrial parasites who use corpses as their hosts. Having a hive mind, the Strangers have been experimenting with humans to analyze their individuality in the hopes that some insight might be revealed that would help their race survive.
Schreber reveals that Murdoch is an anomaly who inadvertently awoke during one midnight process, when Schreber was in the middle of imprinting his latest identity as a murderer. The three embark to find Shell Beach, but it exists only as a poster on a wall at the edge of the city. Frustrated, Murdoch and Bumstead break through the wall, revealing outer space on the other side. The men are confronted by the Strangers, including Mr. Hand, who holds Emma hostage. In the ensuing fight Bumstead and one of the Strangers fall through the hole, revealing the city as an enormous space habitat surrounded by a force field.
The Strangers bring Murdoch to their home beneath the city and force Dr. Schreber to imprint Murdoch with their collective memory, believing Murdoch to be the final result of their experiments. Schreber betrays them by inserting false memories in Murdoch which artificially reestablish his childhood as years spent training and honing his psychokinetic skills and learning about the Strangers and their machines. Murdoch awakens, fully realizing his skills, frees himself and battles with the Strangers, defeating their leader Mr. Book (Ian Richardson) in a psychokinetic fight high above the city.
After learning from Dr. Schreber that Emma's personality is gone and cannot be restored, Murdoch exercises his new-found powers, amplified by the Strangers' machine, to create an actual Shell Beach by flooding the area within the force field with water and forming mountains and beaches. On his way to Shell Beach, Murdoch encounters Mr. Hand and informs him that the Strangers have been searching in the wrong place—the mind—to understand humanity. Murdoch turns the habitat toward the star it had been turned away from, and the city experiences sunlight for the first time.
He opens the door leading out of the city, and steps out to view the sunrise. Beyond him is a pier, where he finds the woman he knew as Emma, now with new memories and a new identity as Anna. Murdoch reintroduces himself as they walk to Shell Beach, beginning their relationship anew.

Question: Who is Anna?
Answer: She is Emma, with new memories.
Alternative answer: Emma's new identity.