Elon Musk lands with his Dragon spacecraft into the Simpsons' backyard. Whilst eating dinner with them, Marge asks why Musk is in Springfield. Elon responds by revealing that the purpose for his stay in Springfield is that he is looking for inspiration. To this, Homer invites him to tag along with him to the power plant. The next day, during the car ride to the power plant, Elon discovers that Homer is the source of new ideas for inventions, as his "Homerisms" (according to Lisa) quickly inspire him. At the power plant, Elon inspires Mr. Burns to install a magnetohydrodynamic generator to the plant, through a suggestion. Burns meets Musk directly, and attempts to hire him, but Elon rejects the offer as he does not care about the money (much to Burns' surprise).
Musk and Burns announce to the town that the power plant has devised new plans for the town's electrical needs (such as Willie spinning a wheel, the Springfield Hyperloop, and Musk's latest project, the Glavinator). Despite the town's cheer to this, Smithers remains suspicious about Elon Musk. It is also announced that Elon invented a brand of self-driving vehicles for Springfield. Bart sneaks into his family's car to disable the auto-drive mode, requiring Musk's master password. He and Lisa go for a joyride in the car, where they land at the power plant, where there is another announcement by Musk. Musk reveals that the town is currently losing roughly $50 million a quarter, much to Burns' horror. Musk explains to Burns that the true intention was to save the Earth. Thanks to Musk, Burns announces to his employees that there will be massive layoffs. Burns then apologizes to an injured Smithers for getting the hounds to attack him (rather than apologize for not believing Smithers in his true suspicion of Musk), and reveals his plot to kill him. Homer, however, is upset, because his ex-friend Musk caused the whole escapade that led to Burns unemploying Lenny, Carl, and the other power plant employees (rather than the fact that his friends are unemployed and it is kind of his fault). Marge advises him to break up with Musk gently.
The next day, while Elon is discussing his ideas for inventions with Homer, Burns attempts to assassinate him. Though the bullet accidentally aims in Homer's way, Musk saves him. Homer gratefully thanks him, but he admits to Musk that he wants to break up with him as best friends. To this, the two share one last hug and one last Homer-inspiration: he tells Musk that the little dolphin on the helmet of the Miami Dolphins is also wearing a helmet (although this was no longer accurate by the time this episode aired, since the team replaced that logo design before the 2013 season). The Simpson family say goodbye to Musk, as he boards his rocket to space. He returns to return Lisa, who attempted to stowaway into the rocket. To make up for Lisa's sadness, he gives the family a futuristic birdhouse (similar to the birdhouse from the start of the episode). Elon then departs, and states there are some things he will miss—such as Homer's last thoughts to him—as he drifts through the quiet, still blackness of outer space.