Max is a lonely child who creates a dreamworld named Planet Drool (similar to Fantasia), where all of his imagination and dreams come to life. He creates two characters, with the first one being Sharkboy who was raised by sharks and his dad. The second character is Lavagirl who can produce fire and lava, but has trouble touching objects without setting them alight. The two left Max to guard Planet Drool. In real life, Max's parents have little time for him, and he is bullied by fellow schoolmate Linus. However, he does receive friendship from Marissa, Mr. Electricidad's (whose name is Spanish for "electricity") daughter. Linus steals Max's Dream Journal, where all of his ideas are kept, and vandalizes it. The next day, a tornado rages outside the school, and moments later Sharkboy and Lavagirl appear and ask Max to come with them to Planet Drool. They reach Planet Drool via a shark-like spacecraft, where Max learns that the dreamworld is turning bad, courtesy of Mr. Electric (also portrayed by George Lopez), originally the guardian of the dreamworld but now corrupted.
Sharkboy and Lavagirl save some children from an out-of-control roller coaster; then, with Max, confront Mr. Electric, who quickly drops them in a part of Planet Drool called the Dream Graveyard where some of Max's dreams have been dumped. They find Tobor (voiced by George Lopez), a robot toy that was never finished being built by Max, but offers them a lift to other parts of the planet. Whilst on the journey, the three form a friendship but they face hardships, such as Sharkboy's anger for the oceans being frozen over, and Lavagirl's desperation to find her true purpose on Planet Drool. They are pursued by Mr. Electric and his "plughounds" across the planet. They plan to visit the Ice Princess and obtain the Crystal Heart, which can freeze time, giving them enough time to get to the center of Planet Drool and fix the dreamworld using Max's daydreaming. However, they are captured by Mr. Electric and delivered to Linus's Planet Drool incarnation, Minus, who has altered the dreamworld with Max's own Dream Journal. Max retrieves the Dream Journal from Minus whilst he is sleeping, and the three escape. Max informs Sharkboy that his father is alive in his book, but when Lavagirl wishes to find out what it says about her, she burns the book to ash. In her rage, Lavagirl confronts Max and asks him why she was made out of lava, but is calmed by Sharkboy.
With little time left, Max, Sharkboy and Lavagirl reach the Ice Princess (Marissa) after an encounter with the Ice Guardian (voiced by George Lopez). She hands over the Crystal Heart, but they find they are too late to stop the corruption. Mr. Electric fools Sharkboy into jumping into water filled with electric eels, seemingly killing him. Lavagirl jumps into the water to retrieve Sharkboy but dies moments later. Tobor's head appears and convinces Max to dream a better and unselfish dream, which in turn revives Sharkboy, who then races Lavagirl to a volcano where she is revived, Max concluding that Lavagirl is light. Max gains reality warping as the Daydreamer and battles Minus, defeating him, and offering to make a better dreamworld between the two of them, which Minus agrees to. Lavagirl then kisses Sharkboy, burning his cheek.
Mr. Electric refuses to accept the new dreamworld, and flies off to Earth to kill Max whilst he is dreaming. Max awakens back in his classroom in the middle of the storm, Mr. Electric materializing before Max and an astonished Mr. Electricidad. Max's parents are caught in the storm, but saved by Sharkboy and Lavagirl. Max gives the Crystal Heart to Marissa, allowing her to gain the Ice Princess' powers, freezing and destroying Mr. Electric. Mr. Electricidad, Linus and Max all make peace with one another, and Max is reunited with his parents.
In the end, Max informs his class that Planet Drool became a proper dreamworld again, Sharkboy became the King of the Ocean, and Lavagirl became Queen of the Volcanoes (even aquatic ones) and Max is shown building Tobor with his parents and Tobor finally worked. It also seems that Sharkboy and Lavagirl begin a relationship. At the very end the two walk away from the camera "holding hands" by touching the tips of their index fingers together so that Sharkboy hopefully won't get burned.