An x-ray reveals that Homer has a crayon lodged in his brain that has been there since he was six years old. Upon removal of the crayon, Homer's IQ suddenly jumps to a very high level; he and Lisa form a great new bond, but when his way of life changes drastically he wonders if removing the crayon was a good idea. This episode is a take on the short story turned novel, Flowers for Algernon by Daniel Keyes, about a mentally challenged man who becomes a genius after an experimental procedure, only to end up alienating those around him.
The next day at work, Homer checks his stocks, the operator tells him that Animotion's stock is up by one. Homer shouts, "Yahoo!" and the operator tells him that Yahoo!'s stocks are up by six. Homer says,"Huh? What the hell is this crap?" He is then sold the FOX network's stocks.
The next day, Homer learns that the Animotion has gone into "super-duper" bankruptcy. In need of a way to regain the lost money, Homer consults his friends at Moe's tavern for ideas. Barney suggests that he takes a job as a human guinea pig. Homer asks if there's a catch and Barney tells him that there will be a few biological sacrifices, while unbuttoning his shirt to reveal multiple ears that have grown on his chest to Moe's shock. So, to earn the family's life savings money back, Homer takes a job at a medical testing center. During most of the experiments the doctors gawk in curiosity at how Homer could be so unintelligent that he can barely complete simple tasks. That is, until the doctors view a 3D xray of his brain and one of the doctors notices something weird sticking out of his right lobe. After a few minor rotations, it is revealed that the object is a crayon lodged in Homer's brain. They ask Homer how this may have happened and Homer explains that it probably happened when he was six and shoving an entire 16 pack of crayons up his nose and when he sneezed them out he just assume that it was all of them. The doctors then tell him that this might be the cause of his lifelong stupidity. They then explain that they could try to remove the crayon which would either leave him with greatly increased intelligence or dead. After contemplating the risk, Homer agrees to undergo the surgery.
After the crayon is removed, Homer's IQ goes up from 55 to 105 points, which allows him to form a bond with Lisa. Homer gives a speech at Springfield Elementary, where Nelson gives him a fake question, saying,"A-moron-says-what?" Homer responds with, "Not being a moron, I wouldn't know. However, [mumbles]" tricking Nelson into saying "what?" Homer says, "Ladies and gentlemen, I give you your moron!" And all the children 'ha-ha!' Nelson.
Homer later visits Ned and shows him that while doing his taxes he inadvertently came up with a formula that proves that there is no God. Ned scoffs until he reads it and dejectedly finds that it's completely right. He quickly burns it to prevent the information from getting out only to see Homer pinning it to car windshields and people already reading it.
Homer then writes a report on the nuclear plant's safety, which results in the plant being shut down, and the laying off of all employees. Homer's friends, initially thrilled to have a smarter Homer around, quickly reject him, and a Homer model is even burned at Moe's Tavern, which he is not allowed in. Lisa tries to explain, with the aid of a graph, that as you get smarter, happiness decreases. Homer decides to put a crayon back in his brain, with the aid of Moe, who says he is an unlicensed surgeon, and describes the procedure as "the old Crayola oblongata". Homer arrives home his old, dumb, self, which initially disappoints Lisa. However, she finds a letter Homer wrote to her before the surgery, explaining that he now understands what it is like to be smart like her, and how much more he appreciates her because of this. When Homer comes into the living room eating a sandwich, Lisa runs up to hug him. Homer mistakes her for wanting his sandwich and pulls away, then saying, "Oh, you want a hug." As they hug, Homer takes another bite of his sandwich and says, "Mmm... hug."