It is sometime in the near future, in a fictional high-tech adult amusement park called Delos. The park is divided into three zones: WesternWorld, MedievalWorld and RomanWorld. The entertainment in all three areas consists primarily of interaction by the guests with androids programmed to act in character (the Old West, medieval Europe, and pre-Christian Rome, respectively). The androids are indistinguishable from human beings, apart from minor flaws in their hands, and guests are encouraged to indulge in any fantasy, including killing the androids. The androids are programmed to respond positively to guest requests, specifically including requests for sex. Delos's guests pay $1,000 a day for the experience.
Peter Martin (Benjamin) a first-timer and his friend John Blane (Brolin), who has visited previously, come to the WesternWorld zone, where one of the main attractions is the Gunslinger (Yul Brynner), a robot programmed to start duels. Thanks to its programming, humans can always outdraw the Gunslinger and kill it. The guns issued to the guests also have temperature sensors that prevent them from firing at each other or anything else living but allow them to 'kill' the room-temperature androids.
Gradually, the technicians running Delos begin to notice problems with the androids. In what may be the first mention of the concept of a computer virus in a film, the technical staff describe inexplicable problems and breakdowns spreading "like a disease" between the machines, first in one area of the park and then on to the others. First, the robots in MedievalWorld begin suffering an inexplicable number of systemic failures. Then, a robot rattlesnake strikes Blane. Against her programming, a female servant android refuses a guest's request for sex. The failures increase until the robotic Black Knight kills a guest in a sword-fight in MedievalWorld. The resort's supervisors, in increasing desperation, attempt to regain control by shutting down power to the entire park. Unfortunately, this results in trapping them in the control rooms, unable to turn the power back on again while the robots run amok on stored power.
Martin and Blane, who have been passed out drunk after a bar fight in the WesternWorld bordello, wake up unaware that there has been a change for the worse. The two men are confronted by the Gunslinger, who challenges them to a showdown. Blane treats the confrontation like a joke, until the robot shoots and kills him. Martin runs for his life as the robot implacably follows him.
Martin flees to the other areas of the park, but finds only a panicky fleeing technician, dead guests and damaged robots. He manages to open a manhole leading to the underground control area, where the resort's technicians have suffocated since the ventilation shut down. The Gunslinger stalks Martin through the corridors, arriving at the robot repair facility where Martin lies in wait, pretending to be a disabled robot. Martin ambushes the Gunslinger by throwing a beaker of hydrochloric acid, found among the repair materials, into its face. Thinking he has disabled the Gunslinger, he leaves the service area and enters MedievalWorld.
However, Martin is again followed by the Gunslinger, whose face has melted but who is still functioning, though its visible spectrum optics were destroyed by the acid. The robot can still see Martin, but only via infrared backups, and is confused when he moves in front of several flaming torches, something it would not have been programmed to deal with in WesternWorld. The Gunslinger begins to leave the room, but Martin accidentally makes a noise, allowing the Gunslinger to zero in on him again. When it lunges to strike, its ammunition exhausted, Martin seizes the opportunity to set fire to it with a large torch.
Thinking this has destroyed the robot, Martin leaves the burning Gunslinger and wanders out of the great hall, finding what he believes to be a female guest chained up in the dungeon. He releases her and gives her a drink of water, whereupon her face bursts into sparks, revealing she is a machine. Backing away in shock, he is confronted by the still moving burned hulk of the Gunslinger, which continues its attempt to attack him. However, it falls off a high set of steps in the process and, finally succumbing to damage, shuts down. Martin, apparently the sole survivor of the humans at Delos, simply sits down on the dungeon steps in a state of near-exhaustion and shock, thinking of the irony of Delos's advertising, "Have we got a vacation for you!"