Sam Lowry (Jonathan Pryce) is a low-level government employee who frequently daydreams of saving a damsel in distress. When a fly gets jammed in a printer and results in the incarceration and accidental death during interrogation of cobbler Archibald Buttle   instead of renegade air conditioning specialist and suspected terrorist Archibald Tuttle   Sam is assigned the task of rectifying the error. Visiting Buttle's widow, Sam encounters their neighbour Jill Layton (Kim Greist), and is astonished to see that she resembles the woman from his recurring dreams. Jill is trying to help Mrs. Buttle determine what happened to her husband, but her efforts are obstructed by bureaucracy. Unknown to her, she is now considered a terrorist accomplice of Tuttle for attempting to report the mistake of Buttle's arrest to a government which would rather dispose of all evidence and witnesses than admit its error. Sam approaches Jill, but she avoids giving him full details, worried the government will track her down.
During this time, Sam comes in contact with Tuttle (Robert De Niro), who once worked for Central Services but left due to his dislike of the tedious and repetitive paperwork. Tuttle helps Sam deal with two Central Services workers, Spoor (Bob Hoskins) and Dowser (Derrick O'Connor), who later return to demolish Sam's ducts and seize his apartment under the guise of fixing the air conditioning. Sam discovers that the only way to learn about Jill is to get transferred to Information Retrieval, where he can access her classified records. He had previously turned down a promotion arranged by his mother, Ida (Katherine Helmond), who is obsessed with the rejuvenating plastic surgery of cosmetic surgeon Dr. Jaffe (Jim Broadbent). Sam retracts his refusal by speaking with Deputy Minister Mr. Helpmann (Peter Vaughan) at a party hosted by Ida. Obtaining Jill's records, Sam tracks her down before she can be arrested, then falsifies the records to fake her death, allowing her to escape pursuit. The two share a romantic night together, but are soon apprehended by the government at gunpoint. Charged with treason for abusing his new position, Sam is restrained to a chair in a large, empty cylindrical room (the interior of a power station cooling tower), to be tortured by his old friend, Jack Lint (Michael Palin). Sam learns that Jill was killed while resisting arrest.
When Jack is about to start the torturing, Tuttle and other members of the resistance break into the Ministry, shooting Jack, rescuing Sam, and blowing up the Ministry building. Sam and Tuttle flee together, but Tuttle disappears amid a mass of scraps of paperwork from the destroyed building. Sam stumbles into the funeral for Ida's friend, who died following excessive cosmetic surgery; finding Ida resembling Jill and being fawned over by young men, Sam falls into the open casket and through a black void. He lands in a street from his daydreams, and attempts to escape police and monsters by climbing a pile of flex-ducts. Opening a door, he passes through it and is surprised to find himself in a trailer driven by Jill. The two leave the city together. However, this "happy ending" is a product of Sam's delusions: he is still strapped to the chair. Realising that Sam has descended into blissful insanity, Jack and Mr. Helpmann declare him a lost cause and leave the room. Sam remains in the chair, smiling and singing "Brazil".
Output: What song is Sam singing?