In a city of the future, use of mind-altering drugs is mandatory and sexual intercourse is prohibited. Drugs are critical both in maintaining compliance among the city's residents and also for ensuring their ability to conduct dangerous and demanding tasks for long periods of time.
Everyone is clothed in the same white work clothes all the time, except the chrome-faced police androids who wear black, and robe-wearing monks. At their jobs in central video CCTV control centers, SEN 5241 (a man) and LUH 3417 (a woman) keep surveillance on the city. On LUH's face there can be seen clear signs of some emotional distress.
LUH has a male roommate, THX 1138. The two share "nothing but space". He works in a factory producing androids that function as police officers. The work is hazardous as it requires handling explosive and radioactive material.
He leaves the job after his shift has ended, while the loudspeakers urge the workers to "increase safety", and congratulate them on their record of "only losing 195 workers" in the last period, to the competing factory's 242.
Returning from work he stops at a telephone booth–like personal Unichapel, one in a row of many, and mumbles prayers about "party" and "masses" while sitting there under the gaze of a wall portrait of a man's face, a being known as "OMM 0910".
A soothing voice greets THX and offers to share his problems. OMM ends every confession with a parting salutation: "You are a true believer, blessings of the State, blessings of the masses. Work hard, increase production, prevent accidents and be happy."
Back at home, it's an empty space almost without any fixtures except the in-wall drug cabinet with inbuilt lens, which greets him with "what's wrong?" when he opens the cabinet's door, and offers him medicine to "improve calmness".
He takes his drugs, watches a holo-broadcast of a naked dancing African woman in an empty room while engaging with a masturbatory device, then switches to scenes of brutal beating of a person by police officers, afterwards. LUH alters her drugs intake, ignoring warnings of dangerous "drugs interaction" coming from the lens in the cabinet. She secretly substitutes her pills for THX's medications.
THX finds himself experiencing emotions and personal affection for the first time. They engage in love-making. Knowing that their physical relationship is illegal, THX must decide whether to return to using the prescribed drugs, or escape with LUH. He knows that he will not be able to function without his drugs while at his demanding job, but he does not want to lose what he has created with LUH.
She suggests an escape out into a "superstructure," but he is indecisive. THX is confronted by SEN, who uses his position as LUH's superior to change her shift, admitting he wants THX as his new roommate. THX files a complaint against SEN for the illegal shift change.
Without drugs in his system, THX falters during critical and hazardous phases of his job, while being monitored by his increasingly concerned supervisor. A control center is alerted to the situation and executes "overriding mindlock" on THX to immobilize him for further arrest for drugs evasion. This occurs at a critical juncture of android construction, which almost leads to a minor nuclear disaster.
The control center disavows responsibility for the incident. THX and LUH are arrested. THX is imprisoned in an area that resembles a white limbo world. He enjoys a brief reunion with LUH—one disrupted by the enforcer robots, not before she reveals to him she is expecting a child. At THX's trial the prosecution demands he be destroyed but the defense argues there still must be some "use" in him. Defense wins.
THX is consigned to another region of limbo, this one populated by a collection of other prisoners, including SEN. Knowing that THX filed the complaint against him, SEN nevertheless rallies him to join his undescribed cause. Most of the prisoners seem uninterested in escape, but eventually THX and SEN decide to find an exit. They encounter SRT 5752, who starred in the holo-broadcasts.
SRT says he has tired of "being a hologram" and wants "to be a real person" now. Exiting their unguarded prison, THX and SRT are separated from SEN. Controllers in the city learn of the escape. A budget of 14,000 credits is allotted for their recapture.
Chased by the robots, THX and SRT are trapped in a control center, from which THX learns that LUH has been "consumed", possibly for organ reclamation (since bodies discovered earlier had, as SRT put it, their "insides...gone") and her name reassigned to fetus 66691 in a growth chamber. This suggests that she has been declared "incurable", and "used".
Alone and hunted, SEN makes a tentative exploration of the limits of the city's underground network. Cowed by what he sees, he finds his way to an area reserved for the monks of OMM. Alone, SEN prays directly to OMM - which is a wall–sized portrait in an abandoned TV studio - before being confronted by a lone monk who notices that SEN has no identification badge.
SEN attacks him before the monk can report him. Returning to the "central web", SEN wanders into a child-rearing area, strikes up a conversation with children and then sits aimlessly there until police androids apprehend him without a fight. THX and SRT escape and steal two cars, but SRT crashes his into a concrete pillar.
Pursued by two police androids on motorcycles, THX in his car flees to the limits of the city. Abandoning his car, THX eventually locates a ventilation shaft leading to the surface. The police pursue him up an escape ladder, but are ordered by central command to cease pursuit.
Though they are close to capturing him, the expense of his capture exceeds their pre-determined budget by 6%. It is then revealed that the city is entirely underground, as he stands before a giant red setting sun in the evening sky, seeing this view for the very first time in his life.