Springfield Elementary School has a new gym teacher, Coach Krupt, who plays a game called Bombardment, which consists solely of Krupt knocking the students over with dodgeballs. When an errant solid-ice dodgeball which Bart made to get back at Krupt destroys Groundskeeper Willie's shack and leaves him homeless, the Simpsons take him in. Lisa decides to make Willie over into a proper gentleman as a project for the school science fair.
When gym teacher Brunella Pommelhorst announces that she will be gone until fall due to her sex change operation, a substitute, Coach Krupt, takes her place. For every gym class, Krupt schedules "Bombardment," which consists solely of him throwing dodgeballs at the students. When Bart gets sick of the constant dodgeball pummeling, he fills a ball full of water and leaves it in the freezer overnight. The next day, Bart brings the frozen ball to class, and Nelson is impressed with the "iceball." Bart throws it at Krupt, who ducks, and the ball crashes through the window and hits Groundskeeper Willie's shack and destroys it. When Marge picks up Bart from school and sees Willie homeless, she offers to let him stay at their house, and he accepts. During Willie's stay with the Simpsons, Lisa helps him realize that his life could be much better, and she decides to turn him into a proper gentleman. Bart, however, doesn't believe that she can do it, but Lisa bets that she can do it in time for the school science fair.
Meanwhile, Homer comes home with his last pair of blue pants ripped and torn after his seat breaks at the go-cart track. As he searches through town for a new pair, he finds no store that sells his favorite type of pants. When he goes to the factory that sells them, the manager tells him that they don't make blue pants anymore due to poor sales, but Homer tells him that he'll get more customers. Not surprisingly for him, he does this by writing "Buy blue pants" on the back of his head. However, it works, and soon everyone is wearing blue pants.
While this is happening, Lisa is struggling to get Willie to act sophisticated. Soon, it is the day before the science fair, and he is still his same old self. When he sees how disappointed Lisa is, he suddenly surprises both Bart and Lisa by correctly (and with a 'proper' accent/dialect) saying a sentence she gave him. At the science fair the next day, he impresses everyone with his politeness. However, no one actually knows that it is the old groundskeeper until Lisa announces it to everyone. Once again, she wins the science fair, and the bet along with it.
Even though he is respected by everybody, Willie misses his old life, but his job and his shack were both taken by the music teacher. He explains to Lisa that he wishes to go back to the way things were, and she understands. Soon, he's back to cleaning and living in his shack. Lisa adds a sign that reads "Home Sweet Home." Willie pretends to like it and needs some alone time. But when Lisa leaves, he destroys it because he liked the shack the way it used to be.