The story is set in a dystopian near-future of an indeterminate year of the 21st century in a nameless authoritarian European country during the Christmas season. Terrorist bombings are frequent and the government's war on these enemies of the state has lasted for a few decades. In a government office a man sitting in a room full of teletype machines swats a fly on the ceiling; the fly falls off the ceiling and into one of the teletypes, changing the name on one printout from "Tuttle" to "Buttle."
At the Buttle home, the family is peacefully trimming their Christmas tree. Suddenly, armed policemen burst into the apartment upstairs and cut a large hole in the floor, dropping down into the Buttle's apartment. After his wife is forced to sign several forms, Buttle is arrested and taken away in a canvas bag.
Meanwhile, Sam Lowry (Jonathan Pryce), a low-level government employee for the nation's Ministry of Information (MOI), often daydreams of himself as a winged warrior saving a beautiful maiden. One day he is assigned the task of trying to rectify the mishap of Buttle's arrest. His boss, Mr Kurtzmann (Ian Holm), is flustered by the appearance of a compensation check issued to Mrs Buttle for her husband. Sam is asked to transfer the funds directly to Mrs Buttle's bank account. The request is sent back because she doesn't have a bank account. Sam says he will drive out to her flat and deliver the check in person.
When Sam visits Buttle's widow, he finds the woman in shock in her living room. He tries to give her the compensation check but she's too upset and hysterically asks where her husband is.
He discovers Jill Layton (Kim Greist), the upstairs neighbor of the Buttles, is the same woman he dreams about. Jill is trying to help Mrs. Buttle find out what happened to her husband, but she has gotten tired of dealing with the bureaucratic paperwork and the run-around from various departments at MOI, while unbeknownst to her, she is now considered a terrorist friend of Harry Tuttle, a rogue air conditioning specialist who once worked for the government but left due to the amount of paperwork. When Sam tries to approach her, she is very cautious and avoids giving Sam full details, worried the government will track her down.
Later that night, Sam comes in contact with the real Harry Tuttle (Robert De Niro). Tuttle has intercepted Sam's call to deal with his malfunctioning climate control -- Tuttle's covert work is highly illegal and he's is intensely cautious when he enters Sam's flat, having been nearly trapped before. Tuttle jabbers about how he left government service and that the country has become "cordoned off" and offers to bypass a faulty component in Sam's nightmarish duct work. Sam helps Tuttle avoid detection when two Central Services workers, Spoor (Bob Hoskins) and Dowser (Derrick O'Connor) have shown up to deal with the air conditioning. When Sam tries to pay Tuttle, the repairman waves off the money saying that Sam had done him a favor by helping him hide from Spoor and Dowser . Tuttle exits flamboyantly, sliding down a nearby cable right after telling Sam "Remember Kid, we're all in this together!"
Sam determines the only way to fully learn about Jill is to accept a promotion to "Information Retrieval" where he would have access to her classified records as she is considered a terrorist. He requests the help of his mother Ida (Katherine Helmond), vainly addicted to rejuvenating plastic surgery under the care of cosmetic surgeon Dr. Jaffe (Jim Broadbent), as she has connections to high ranking officers and is able to help her son get the position. His mother is delighted; she'd long since been frustrated at her son's lack of ambition, and the promotion Sam receives is one his mother has previously arranged for him but that Sam had declined.
When Sam arrives at Information Retrieval, he is treated like a bureaucrat and given his own tiny office in their bleak and cavernous hallways. He soon discovers that he literally shares a desk with the agent next door, Harry Lime (Charles McKeown). Lime has a functioning computer and Sam eventually obtains Jill's records. He leaves to track her down before she gets in trouble. Before he goes to find her, he meets with an old friend of his, Jack Lint (Michael Palin) who, despite his pleasant personality, is actually an MOI agent who tortures and interrogates government prisoners. Jack warns Sam not to dig too deeply into the darker affairs of MOI because it can be a danger to Sam as well as Jill.
When Sam finds Jill driving a large truck outside the entrance to MOI, he joins her, despite her obvious reluctance. He also notices that she picks up a mysterious package, which he believes is a bomb. While they're out shopping, a bomb goes off in the store and Sam immediately thinks Jill planted it.
Sam returns to his flat to find Tuttle waiting outside. Spoor and Dowser are inside, wearing contamination suits amidst a tangle of hanging duct work. The two had retreated from Sam's apartment when Sam had asked them for the proper paperwork and have returned with the document, a 27B-6. They've also found the small device Tuttle had installed to bypass the duct work problem in the ventilation system. Sam walks out of the apartment and finds Tuttle, who switches the air couplings in Dower's and Spoor's suits for the apartment's sewage hose and gives Sam a periscope to watch them explode when their suits fill up. After Tuttle leaves, Sam sees Jill standing there. He takes Jill to his mother's home for safety and returns to his office, falsifying her records to make her appear deceased, allowing her to escape the bureaucracy. The two share a romantic night together before Sam is apprehended by the government at gun-point for misusing his position.
After being read a long list of charges, Sam is now considered part of an assumed terrorist plot including Jill and Tuttle. Sam is taken to a cavernous smokestack and given to a government agent, dressed in a doctor's coat and a baby's mask, to be tortured. Terrified, Sam figures out that his torturer is Jack Lint and pleads with him. Jack is also very frightened at the though of having to torture his friend but as he begins, Tuttle and other members of the resistance shoot Jack dead and save Sam, blowing up the Ministry building as they flee in a hail of gunfire. As they try to disappear into the crowds, Tuttle's disappearance is more surreal and mysterious -- littered paperwork that had been lying in the streets suddenly adheres itself to his body. When Jack tries to help him, Tuttle's body has disappeared inside the paper.
The scenes become more dream-like as Sam runs to his mother at a funeral. The funeral is described as that of Mrs. Terrain (Barbara Hicks), a friend of his mother's who over the course of the film has suffered increasing "complications" as she has submitted to the "acid treatment" of Dr. Chapman (Jack Purvis), a rival of Dr. Jaffe and whose technique Sam's mother does not hold in high regard. Sam's mother, thanks to Dr. Jaffe's repeated surgery, now seems as if she's in her 20s again, looking exactly like Jill, and is surrounded by a flock of juvenile admirers younger than Sam himself. She refuses to help and, falling into Mrs. Terrain's seemingly bottomless coffin, he then continues to run from the police in streets that more and more resemble the concrete and brick walls of his daydreams.
When Sam finds himself surrounded on three sides by the police and the imaginary monsters of his nightmares, he turns to the only escape way left and climbs up a seemingly insurmountable pile of old flex-ducts such as those running the world of Brazil, and finds sanctuary in a trailer driven by Jill, whereupon the two leave the city together and settle in the countryside, free from their past lives.
However, it is quickly revealed all of Sam's adventures since his arrest, including the happy ending, are all happening inside Sam's head. In front of the idyllic final scene, two faces come into view staring at the camera, that of Jack and of Mr. Helpmann (Peter Vaughan), a wheelchair-bound man who works as the Deputy Minister of the Ministry of Information, the system's highest official. The two men now realize that Sam has been reduced to a catatonic state at the hands of Jack and that he won't reveal any more to them. Jack gives up trying to torture Sam further and Sam is left still sitting in his chair with a smile on his face, quietly humming "Brazil" as Jack moves Mr. Helpmann in his wheelchair out of the room.
(In an alternate version of the film, subtitled the "Love Conquers All" edition, Sam's dream ends with the idyllic life he's taken up with Jill in the small house in the countryside.)