Thanks to Bart leaving his lucky red hat in the load of washed white shirts, Homer wears a pink shirt to the nuclear power plant. He is promptly committed to a mental institution where he meets up with a heavy-set, bald, white man, Leon Kompowsky, who walks and talks like Michael Jackson. And where Bart doesn't know what to get for Lisa's birthday.
At the opening of the show, Lisa reminds Bart that her birthday is coming up and not to forget to get her a present. Homer's traditional white shirt turns pink in the wash, and he is forced to face the ridicule of his co-workers by wearing pink to work. He catches the attention of Mr. Burns, who pegs him as "some kind of free-thinking anarchist", and orders him to be examined by Dr. Marvin Monroe. After receiving a take-home psychological test from him, he has Bart fill it out for him. After handing it in, he is promptly judged to be insane and committed to a mental institution. There he is bunked with a large white man who claims he is Michael Jackson. The two quickly become friends.
The day of Lisa's birthday, "Michael" calls the Simpson household to let Bart know that Homer has been committed, and Marge starts working on a way to get him out. Marge manages to convince the institution that Homer is not really crazy by pointing out Bart's antics that made Homer go crazy in the first place. Homer invites "Michael" to their home for the night. Bart, believing that Leon is really Michael Jackson, begins to inform all his friends that he is on his way. Meanwhile, in all the commotion, Lisa seems to be forgotten.
The word that Michael Jackson is on his way to Springfield, begins to spread through the town, and a large crowd forms around the Simpson house. When the two of them arrive, and the crowd sees a large, white man instead of Michael Jackson, the crowd gets angry and disperses. After the melee, Bart admits to Lisa that he forgot to buy her a birthday present. Lisa storms off, crushed.
That evening, Lisa writes a letter to Bart saying that she is disowning him. "Michael" hears everything and then approaches Bart and tries to convince him to write Lisa a song to make up to her. After Bart confronts him about his obvious delusion about being a famous recording star, they get down to writing, and eventually compose a ballad called, "Happy Birthday Lisa." The next day they perform it for her, and all is well again. After this, "Michael" tells them all that his real name is Leon Kompowsky, and he's a bricklayer from Paterson, NJ. He tells them that he was an angry and unhappy man until he started talking like Michael Jackson and saw that it made everyone around him happy, which in turn made him happy, so he just kept on doing it. Leon then takes his leave, walking down the street singing Lisa's birthday song in his normal voice.
Michael Jackson himself voiced Leon Kompowsky's dialogue, and sound-a-like Kipp Lennon performed all the singing parts. Jackson's guest appearance was credited to "John Jay Smith." The DVD commentary for this episode indicates that Jackson approached the Simpsons team wanting to appear on the show, but due to a contract obligation, was not allowed to sing. However, he did write "Happy Birthday, Lisa" for the show. Great secrecy surrounded the guest appearance for some time, and even Matt Groening, when appearing on the Jay Leno show, did not openly reveal that it was Jackson (although he hinted strongly). It wasn't until the episode "Itchy & Scratchy: The Movie" that a more open clue was given to viewers, when Lisa mentions that Dustin Hoffman and Michael Jackson made cameo appearances in the movie, stating, "They didn't use their real names, but you could tell it was them..." (Dustin Hoffman, of course, voiced Mr. Bergstrom in the episode Lisa's Substitute, and his guest appearance was similarly shrouded).