The movie opens with an Itchy and Scratchy cartoon where they land on the moon, and Itchy becomes the US President after beating up and leaving Scratchy for dead on the moon. It turns out Scratchy survived, and threatens, "I'm telling!" Itchy panics, and decides to launch all of America's nuclear warheads at the moon so that Scratchy does indeed die this time. Homer complains the movie is boring, and calls everyone at the theater (and, by proxy, the audience) a giant sucker for paying to watch something they could watch at home for free.
Green Day plays a concert on a barge at Springfield Lake. After performing their version of the show's theme song, lead singer Billie Joe Armstrong takes time out to talk about the environment. This gets boos from the audience, even as the polluted lake dissolves the barge, plunging the band to their deaths. At the funeral service next morning, Abe suddenly has a vision of a grim future; writhing on the floor, he rants "A thousand eyes! Twisted tail! Eepa! EEEEPAAA!" Everyone else in the family dismisses it as one of Grampa's "Senior moments", but Marge is concerned and tries to decipher the sinister warning.
Lisa is concerned over the increasing levels of pollution being done to Lake Springfield, and tries rallying up the town in support of greater environmental awareness, eventually succeeding with the help of the Mayor in securing borders of Lake Springfield which the people have been using as their own private toilet. Homer has to fix chores such as cleaning out a hornets nest, fixing the sinkhole in their backyard and re-shingling the roof. For the latter task, Homer accidentally lodges the hammer's end into his own eye while trying to pound a nail down, making Bart laugh at him. Homer starts strangling Bart out of anger only for Bart to (very poorly) rationalize his laughing that hes just bored with the chores. Homer out of spite dares Bart to go skateboard to Krusty Burger in the nude, and threatens to humiliate him daily with chicken sounds ("Bawk bawk bawk") if he doesnt go with the dare.
Bart does so, and the police arrest him for indecent exposure. Homer denies any part of this to Chief Wiggum, so hes let off the hook and stops for lunch at Krusty Burger where Ned fully clothes Bart back to modesty. While having lunch, Homer adopts a pig whos run to him for protection before it could get slaughtered for its meat. Marge is concerned that the pig may represent the "twisted tail" in Abe's vision. She demands Homer get rid of the pig, but he refuses wanting to keep it as a pet. Meanwhile, Bart is angry at Homer and grows increasingly attached to Flanders for a father figure for his better manners. Eventually, Homers pig is making too much defecation for Homer to keep up with storage. After being coerced by Marge to dispose of it, Homer arrives at a waste facility only to be told by Lenny on the phone that Lard Lads Donuts is giving away free donuts due to a failed health inspection because of rats found there.
Homer, wanting to get free donuts himself and refusing to wait, hurries over to the lake breaking through all of Lisa's established concrete barriers and eventually releasing the silo full of his pigs feces into the lake, corroding the lake into a fizzing pure green, then very dark green toxic cesspool to which a skull-and-bones symbol appears and announces "EVIL!". As while Ned and Bart are fishing and hiking together, the EPA arrives and collects a squirrel mutated by the lake (the "thousand eyes" from Grampa's warning). EPAs head Russ Cargill presents the squirrel to U.S. President Arnold Schwarzenegger, asking the latter to go with intensive measures to address this issue. Schwarzenegger blindly picks the issue of immediate quarantine without knowing what he picked since he refuses to more carefully analyze what hes choosing.
Schwarzeneggers blind-picking plan involves sealing the entire city of Springfield under a dome made of a transparent glass-like material that is so durable nothing can cut through it. Marge then finds Maggie outside the dome, and in a panic alerts Homer only to find Maggie is somehow back inside their backyard. When the parents leave confused and uncertain, Maggie then reveals to the viewer that the sinkhole Homer neglected to fix earlier was her ticket out of the dome. Soon, Homer is found culpable of having polluted the lake that was what brought on the dome when police fish out his silo (which Homer wrote his full name on), and the whole town goes to lynch him with torches and pitchforks. His family is also wanted along with him, and they barely escape the mobs wrath. Flanders attempts to help by bridging them into his own house, but Homer's pig interferes with it so as that they can avoid the arrows directed at them by Skinner's archers. The Simpsons retreat to Bart's treehouse, where the mob proceeds to try bringing down the tree but Maggie saves them just in time using a quicksand box that helped her escape the dome earlier. In the process of Homer clogging up the sinkhole as he escapes, the sinkhole expands, swallowing up Homers car, the backyard tree and completely destroying the Simpsons house. The mob walks off disappointed, and Homer instructs the family to flee before Russ Cargill can spot them.
Homer at a motel begs his family for forgiveness and that hell make it up for them by relocating them all to a new life in Alaska where they may have to spend the rest of their lives as fugitives but at least they wont be lynched or prosecuted. Without much transportation and running low on cash, Homer is forced to enter a motorcycle-cage sphere challenge where the prize is a truck in which he must ride inside the sphere with the motorcycle (after Lisa corrects his strategic thinking). Marge and Bart barely escape being noticed at a gas station where a WANTED sign is posted of their family. As Homer promised, they arrive in Alaska where they enjoy the luminescent and bright landscape and even unexpectedly receive a $1,000 stipend from a tollbooth man (the Alaskan Permanent Fund). Homer and Marge embrace their new lives in Alaska inside a wooden cabin.
Meanwhile, chaos pursues in Springfield as food and energy supplies hit a severe shortage - making the Springfielders desperately try to break through with whatever they can find. Stampy the elephant makes a small crack, alerting Cargill who runs back to Schwarzenegger wildly pressuring him to pick the option of Option #4, by manipulating the president into thinking that letting Cargill choose it for himself would be a wiser decision. Cargill wants Option 4 because it is to blow up Springfield and decimate it into a second Grand Canyon.
When watching a commercial on TV with Tom Hanks claiming that a new Grand Canyon will come where no one or nothing ever was, Marge deduces that Springfield will be destroyed and that theyll have to save the town. Homer refuses to save the same people who tried to kill him, and storms off when he gets fed up with Marges insistence they return back there. Homer goes to relax at a lounge drinking and playing video games, but when he returns hes given a VHS tape Marge made for him (it was taped over their wedding video) revealing that the whole family abandoned him to go back and save Springfield. Homer runs outside to search for them, but he collapses out of despair and hopelessness believing hes truly lost his family and floats on a piece of ice that breaks away into the sea. A polar bear tries eating him, but an Inuit woman intervenes and preaches to him that he must go join his family on their quest to save Springfield if he ever wants to reunite with them again. Cargill opens the seal on top of the dome by helicopter and puts in it a bomb that will kill the entire town, making the people flee in fear and trying to take cover.
Marge and the kids are apprehended by the EPA and thrown back inside the dome thanks to Marge giving away her information to the NSA. Homer reaches Springfield in time, but he accidentally interferes with the townspeoples carefully elaborated plan of escaping the dome before the bomb can go off as they tried to climb the rope that was keeping the bomb in place. Homer is able to find where Bart is, but he storms off claiming You doomed us all, again! Bart then goes to church with Flanders is and tries to be inaugurated as a third son, with Flanders claiming that there will always be room for one more in the Flanders family. Spotting a motorcycle, Homer uses it to hone his recently gained skills of motorcycling and asks Bart to help him dispose of the bomb. Bart gleefully accepts this mission, and once Homer reaches a distance close enough to the opening Bart succeeds in tossing the bomb out the domes hole, where it lands on top of the dome, thus shattering the dome and liberating the people who celebrate in rejoice. After a very risky landing, Homer and Bart are cornered on a mountain cliff by Russ who loads a barrel shotgun and prepares to kill Homer (most likely Bart afterwards) as revenge for foiling his plans. But Maggie shows up in time to knock out Russ with a boulder on his head. Homer then reunites with Marge, and they drive off into the sunset as the town praises Homer and the Simpsons work to rebuild their house.