Peter Gibbons, a programmer at a company called Initech, is frustrated and unmotivated at his job. His co-workers include Samir Nagheenanajar and Michael Bolton, also programmers, and Milton Waddams, a meek collator who is mostly ignored by the rest of the office. The staff is constantly mistreated by management – especially by Initech's smarmy, callous vice president, Bill Lumbergh, who Peter loathes – and is further agitated by the arrival of two consultants, Bob Slydell and Bob Porter, who are brought in to help the company through downsizing and outsourcing.
Peter's girlfriend, Anne, persuades him to attend an occupational hypnotherapy session, but the therapist, Dr. Swanson, dies of a heart attack right after hypnotizing Peter. Peter wakes up the next morning newly relaxed, and ignores repeated phone calls both from Anne, who responds by angrily breaking up with him and admitting she has been cheating on him, confirming his friends' suspicions, and from Lumbergh, who had been expecting Peter to work over the weekend. The following workday, Peter decides to skip work and asks Joanna, a waitress at Chotchkie's, a nearby chain restaurant, out to lunch. Joanna and Peter bond over their shared loathing of idiotic management and love of the television program Kung Fu.
When Peter finally shows up at work, he casually disregards office protocol, including violating Initech's dress code, taking Lumbergh's reserved parking spot, refusing to follow Lumbergh's directions, and removing a cubicle wall that blocks his view out the window. The consultants, however, are impressed by his frank insights into the office's problems, and decide to promote him. They also confide that Michael and Samir's jobs will be eliminated, and when Peter relays this news to them, the trio decide to get even by infecting Initech's accounting system with a computer virus designed to divert fractions of pennies into a bank account they control, transactions they believe are small enough to avoid detection, but which over time will result in a substantial amount of money. On Michael and Samir's last day at Initech, Peter takes one last item: a frequently malfunctioning printer, which the three take to a field and smash to pieces to vent their frustration.
At a barbecue, Peter learns that Joanna had previously slept with a colleague, identified as "Lumbergh." Assuming it to be his boss, he becomes disgusted with Joanna, and after she questions his financial scheme, confronts her, and the two split up. He then discovers that a bug in Michael's code has caused their virus to steal over $300,000 (exactly $305,326.13) in only a few days, which is far more conspicuous to the company; Michael put the decimal point in the wrong place. Peter admits to Joanna – who has finally stood up to her boss at Chotchkie's and quit, and whom Peter has discovered had in fact slept with a different "Lumbergh" – that the scheme was a bad idea and plans to accept responsibility for the crime. He writes a letter confessing everything and slips it and anonymous checks for the stolen money under the door of Lumbergh's office late at night. The next morning, Milton – who has become more and more disgruntled at his treatment by management, to the point that he has mumbled threats about setting the building on fire – enters Lumbergh's office to reclaim a stapler that was taken from him.
Fully expecting to be arrested upon arriving at work, Peter instead finds that his problem has solved itself: the Initech building is engulfed in flames, and all evidence of the missing money has been destroyed. Peter finally finds a job that he likes: doing construction work with his next-door neighbor, Lawrence. Samir and Michael both get jobs at Initech's competitor, Initrode. Meanwhile, Milton lounges on the beach at a fancy Mexican resort, complaining about his beverage and threatening to take his business to a competitor (having picked up Peter's envelope containing the traveller's checks and cashed them in).

Question: Why does Peter decide to repay all the money he has stolen?
Answer: Because he decides it was a bad idea and wants to take responsibility.
Alternative answer: He realizes that they stole too much