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. Men 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.
Sam Lowry (Jonathan Pryce) is a low-level government employee for the nation's Ministry of Information (MOI), often daydreaming of himself as a winged warrior saving a beautiful maiden. One day he is assigned the task of trying to rectify an error created by a government mishap, causing the arrest and incarceration of a Mr. Harry Buttle instead of a suspected terrorist, Harry Tuttle. 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'll 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 as in his dreams. 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, in turn, considered a terrorist friend of Tuttle for trying to report the mistake of Buttle's arrest. 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), a renegade air conditioning specialist who once worked for the government but left due to the amount of paperwork. Tuttle has come to Sam's flat 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 helps Sam deal with two government workers, Spoor (Bob Hoskins) and Dowser (Derrick O'Connor), who are taking their time fixing the broken air conditioning in Sam's apartment. When Sam tries to pay Tuttle, the repairman waves off the money saying that Sam had done him a favor by concealing his presence in his apartment when Spoor & Dowser arrived. 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 as she used to be frustrated at her son's prior lack of ambition, and the promotion Sam receives is one his mother has previously arranged for him but that Sam had declined before.
When same 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 agent who tortures and interrogates MOI 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. Tuttle switches the air couplings in their 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 given to Jack Lint to be tortured, as he is now considered part of an assumed terrorist plot including Jill and Tuttle. However, before Jack can begin, Tuttle and other members of the resistance shoot Jack 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. Other than Mrs. Terrain, recently deceased due to her cosmetic surgery gone wrong, Sam's mother, thanks to Dr. Jaffe's repeated surgery, now seems as if she's in her 20s again, looking exactly like Sam's love interest 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 nightmare 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 of the past few minutes, including the happy ending, are all happening inside Sam's head. In front of the idyllic scene, two faces come into view staring at the camera, that of Jack and of Mr. Helpmann (Peter Vaughan), who as Deputy Minister of the Ministry of Information is the system's highest official we see in the film. What they are looking at, as they now realize, is Sam having become catatonic at Jack's hands. Apparently the whole escape from the Ministry of Information and the scenes afterwards were all part of a dream that Sam had while being tortured. Seeing that Sam is too far gone to reveal any more information, Jack gives up trying to torture Sam further. 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 away from the scene.
In an alternate version of the film, subtitled the "Love Conquers All" edition, Jack's dream ends with the idyllic life he's taken up with Jill in the small house in the countryside.