SpongeBob wakes up on a normal day as usual and gives his pet snail Gary a tight hug that is enough to break his shell. Angered, Gary attacks his owner and SpongeBob runs out of his house, yelling his apology. He bumps into Patrick, causing the birthday cake he made for his mother's birthday to be ruined. Patrick goes into his rock and calls SpongeBob "Idiot Boy". Believing Squidward would "enjoy" his company, SpongeBob knocks on Squidward's door, but he tells SpongeBob to never wake him from his sleep. He calls him "Idiot Boy" and closes the door. At her treedome, Sandy finishes building a robot that dances for her with fans, SpongeBob appears and comments about the robot. As he gets closer, SpongeBob trips over a log and some of the water from his water helmet pours out onto the robot, making it explode. Sandy is angry at SpongeBob, she pushes him out of the dome and exclaims "Idiot Boy" in a mean tone. SpongeBob heads to the Krusty Krab but ends up creating a mishap that results in getting two dollars fried and reduced to bits, with a furious Mr. Krabs kicking SpongeBob out of the restaurant and telling him that he should get as far away from the Krusty Krab as possible, and like the others did, Mr. Krabs calls SpongeBob "Idiot Boy". SpongeBob decides to leave Bikini Bottom and tells Gary that he has a year's supply of snail food to eat since SpongeBob will not be there to feed him. After leaving Bikini Bottom, he is scared by bizarre people and as he runs in fear, SpongeBob falls off a cliff and bumps his head, knocking himself unconscious. Back in Bikini Bottom, Patrick and Sandy enter SpongeBob's house and they see Gary has become hugely obese from the snail food. Sandy finds that Gary's food bowl has a note from SpongeBob, saying he has left so that he will not bother anyone ever again. After Sandy reads it, she and Patrick look at each other in remorse.

Meanwhile, SpongeBob wakes up with amnesia. He sees two fishes who have found his clothes and express interest in using them; SpongeBob mentions that he cannot remember anything except hitting his head, so the fish tell him that his name is "CheeseHead BrownPants". However, they run in fear when they find out SpongeBob has a bottle of bubble soap. He wonders what was the problem and spots New Kelp City. Sandy and Patrick arrive at the Krusty Krab where costumers have gathered, angered about not getting their orders. Sandy shows the note from SpongeBob Mr. Krabs, after he reads it, the group (except for Squidward who is happy about SpongeBob being gone) all become upset about making SpongeBob leave. Mr. Krabs makes the costumers leave, telling them that the place is closed until further notice so that he and the other can decide on how to find SpongeBob.

SpongeBob wanders around New Kelp City and upon getting accused of pickpocketing by a civilian and noticing his hunger, decides he needs to get a job. Each time he gets a job however, he uses his bubble blowing, resulting in him getting fired. Back in Bikini Bottom, Sandy has a device that can locate any sponges within a 50-mile radius. Determent to not see SpongeBob again, Squidward destroys it. Deeply angered by Squidward's actions, Mr. Krabs orders him to look for SpongeBob. Squidward refuses at first but changes his mind when Mr. Krabs prompts him with his retirement gift: a Fabergé egg. SpongeBob's activity with blowing bubbles, brings up a confrontation with "the Bubble Poppin' Boys", a gang who have scared the city into never blowing bubbles because they keep being blinded by the bubbles whenever they pop. SpongeBob uses his bubble blowing to trap the gang in a giant bubble that flies out of town. He is rewarded by getting the position of mayor of New Kelp City.

Sandy, Patrick, and Squidward arrive at a gas station and from reading a newspaper article, discover SpongeBob's appointment as mayor of New Kelp City. But when they go to New Kelp City to retrieve him, SpongeBob cannot remember who they are. Squidward hi-jinks SpongeBob's limousine and gets away from the city with SpongeBob, Patrick and Sandy in tow and they return to the Krusty Krab. SpongeBob still does not recall the eatery and wants to return to New Kelp City to resume his job as mayor. Delighted that SpongeBob is leaving again, Squidward request for his jewel encrusted egg but slips and accidentally throws the egg onto SpongeBob's head, which causes his memory to come back. But even so, SpongeBob still wants to return to New Kelp City. At that moment, a breaking news report comes on, saying that the bubbles in New Kelp City are blinding the citizens, and a thug threatens to do something to SpongeBob if he ever comes back. This makes SpongeBob change his mind and he starts cooking Krabby Patties, Patrick eats a freshly prepared Patty and Sandy tells SpongeBob that it is good to have him back. With a sigh of happiness, SpongeBob says that it looks like he will stay in Bikini Bottom.