Homer leaves the house to attend a nuclear power convention in Boise, Idaho with Lenny and Carl. The three use the occasion as an excuse to drink heavily, starting during the drive to the airport, and collect as much free merchandise as they can. Even though they are thrown out of the convention for their bad behavior, they attend the post-closing party. The rest of the Simpson family waits to greet Homer at the airport, but his failure to appear shocks them. Lenny and Carl ineptly try to console the Simpsons, and Patty and Selma do so with malicious glee.
Homer returns several days later, but with noticeable changes in his behavior: he no longer strangles Bart for making sarcastic remarks, he will not eat pork chops or drink beer, and he prostrates himself on what appears to be a prayer mat while facing toward the Middle East. He has occasional short flashbacks of entering an unmarked van and sitting in a chair with headphones on and his wrists clamped down, as if being tortured. Overhearing a conversation between Chief Wiggum and Apu about rumors of a terrorist operative in Springfield, Lisa begins to suspect that Homer may have been kidnapped and indoctrinated as a Muslim in order to carry out an attack. When she sees him looking at blueprints of the Springfield Nuclear Power Plant, her fears drive her to notify the FBI.
Agent Annie Crawford, who suffers from bipolar disorder, fields Lisa's call and leads a team to investigate. She infiltrates a sleepover that Bart and Milhouse are having, then slips into bed with Homer and Marge to tell him that she knows what he is planning. The next day, Homer brings a large, tarp-covered device through the security gate and into the plant, and sets it up in the basement. Lisa races to the plant in an effort to prevent Homer from destroying it, but he tells her that he is only going to ensure that the plant will not do any more damage to the environment. His device is actually a tank filled with sour milk and spoiled chicken, which he plans to pump into the air conditioning system so that the stench will drive everyone off the property.
Homer had overslept and missed his flight home from Boise. The van he climbed into was used by a group of ecological activist hippies, who gave him a ride back to Springfield. Along the way, they persuaded him to become a vegetarian, convinced him of the plant's destructive effects on the environment, and put him through an alcohol detoxification treatment that involved listening to Grateful Dead music and sitting in a sauna for days on end (hence the headphones and chair with wrist clamps). The mat Lisa saw Homer using was a rug marked with affirmations in very small print, forcing him to kneel in order to read them.
Annie and her team burst in and restrain Homer, but Lisa activates the device in order to complete his work, realizing that they have at least one thing in common now - a desire to see the plant shut down for good. The mission fails because the air conditioning system never worked properly in the first place, but since this is a safety violation, the plant must be shut down temporarily to correct it and Mr. Burns is arrested. Lisa hopes that Homer might retain his new behavior, but he quickly reverts to his old ways upon drinking a Duff beer that floats down from the sky on a parachute, under the control of a cackling Moe. Annie takes a large dose of medication for her bipolar disorder, turning the dreary city block into a vivid rainbow daze, and pushes Ralph Wiggum to the ground as she walks away from the plant.