Bart wins a radio contest which allows him to choose between two prizes: $10,000 or an elephant. Bart picks the elephant and names him Stampy. Homer and Marge decide to give the elephant away because he costs too much to feed, so Bart and Stampy run away together.
During a cleaning day at the Simpsons' house, Bart wins a KBBL radio contest after the station's DJs, Bill and Marty, call him up. They give Bart the choice of two prizes: $10,000 in cash or the "gag" prize: a full-grown African elephant. Bart ends up choosing the elephant. This surprises Bill and Marty, who (understandably) believed that no one would ever actually take the gag prize, and thus have no elephant to give away. They instead offer Bart the money and a variety of other prizes, all of which he refuses, saying that he only wants the elephant. Word spreads throughout town about Bill and Marty's refusal to give Bart an elephant, prompting their boss to give them a choice: either arrange for the delivery of an elephant, or lose their jobs to a DJ machine. They decide on the former option.
Bart names his new elephant Stampy and ties him to a post in the backyard. Lisa complains that it's cruel to keep an animal like an elephant as a pet, while Homer's concerned that Stampy will eat him out of house and home. In an effort to offset food costs, Bart and Homer exhibit Stampy by charging customers to see and ride him, but fail to earn enough to cover even one day's food bill. The customers all flee after Homer raises their prices to exorbitant levels. Homer declares they can't afford the elephant and must sell him, much to Bart's dismay. The family is visited by a representative of a game reserve, who says their acres of open land similar to AfricanSavannah would be a good habitat for the elephant to live in. However, Homer dismisses this as he learns that he will not receive any money for it since the reserve is a non-profit organization.
A wildlife poacher named Mr. Blackheart then offers to buy Stampy. Homer wants to take the money, but Bart and Lisa are against the idea---especially after Mr. Blackheart openly admits to being an ivory dealer. Homer and Mr. Blackheart reach a deal, but Bart and Stampy run off, wreaking havoc throughout Springfield, and are soon nowhere to be found. The family begins searching and finds them at the Springfield Tar Pits, where Homer still plans to sell Stampy to the ivory dealer for the money. Bart and Lisa then angrily ask if Homer would like to be sold to an ivory dealer himself, to which Homer responds positively, before finding out that he's stuck in one of the tar pits. Bart orders Stampy to free Homer, to which he does (after first pulling out Barney Gumble). A grateful Homer agrees to donate the elephant to the wildlife reserve. While at the reserve, Stampy starts head-butting other elephants, cheered on by Bart. Marge is surprised by this, and the representative explains that animals are a lot like humans: some act badly because they've had a hard life or they've been mistreated; but, like humans, some animals are just jerks (which he says while Homer's head-butting him, still angry over not getting any money).