Lewis is an aspiring young inventor at an orphanage whose inventions have been scaring off potential parents. He decides that his mother is the only one who truly loves him and works on a machine to scan his memory to locate her. Unfortunately, this keeps his roommate Michael "Goob" Yagoobian awake, which then causes Goob to fall asleep during an important Little League game.
Taking his memory scanner to his school's science fair, Lewis meets Wilbur Robinson, a mysterious boy claiming to be a time cop from the future. Wilbur needs to recover a time machine that a man wearing a bowler hat has stolen. Lewis tries to demonstrate the scanner, but it falls apart, throwing the science fair into chaos. Upset, Lewis leaves while the Bowler Hat Guy, with the help of a robotic bowler hat named Doris, repairs and steals the scanner.
Wilbur meets Lewis at the orphanage and asks him to repair the scanner. Lewis agrees to do so only if Wilbur can prove he is telling the truth, which Wilbur does by taking them to the year 2037 in a second time machine. When they arrive, however, Lewis says he can use the time machine instead of the scanner, and he and Wilbur get into an argument and crash. Wilbur then asks Lewis to fix the time machine, but Lewis has another condition: Wilbur has to take him to visit his mother afterward. Reluctantly, Wilbur agrees and hides Lewis in the garage. Lewis doesn't stay there for long, however, and ends up meeting the rest of the Robinsons except for Cornelius, Wilbur's father.
Following Lewis, the Bowler Hat Guy and Doris unsuccessfully try to kidnap him. Meanwhile, the Robinsons offer to adopt Lewis, but change their mind when they learn that he's from the past. Wilbur also admits to lying to Lewis about taking him back to see his mom, causing Lewis to run off in disgust.
Lewis then discovers that the Bowler Hat Guy is a grown-up version of Goob. After losing the Little League game, Goob had become so bitter that he was never adopted and remained in the orphanage long after it closed. Doris was "DOR-15," one of Lewis' failed and abandoned inventions. They both blamed Lewis for their misfortunes and decided to ruin his career by stealing the memory scanner and claiming credit for it. Leaving Lewis behind, they take off with the scanner, drastically altering the future to a world minus Wilbur and dominated by Doris clones. Lewis repairs the second time machine, goes to confront Doris and destroys her by promising to never invent her, restoring the future to its utopian self.
Back in Wilbur's time, Lewis finally meets Cornelius, who is a grown-up version of Lewis. Cornelius explains how the memory scanner had started their successful career, which persuades Lewis to return to the science fair. Wilbur takes Lewis back, but makes one stop first: as he promised, he takes Lewis back to when his mother abandoned him. Lewis nearly stops her from leaving the infant at the orphanage, but decides not to, explaining to Wilbur that he already has a family.
Wilbur drops Lewis off in his own time and leaves. Lewis heads to the fair, but enroute wakes up Goob just in time for him to make the winning catch. Back at the fair, Lewis asks for one more chance to demonstrate his scanner, which this time succeeds. He is adopted by Lucille, one of the science fair judges, and her husband Bud, who nickname him "Cornelius" and take him to their home. As Lewis leaves, he turns and waves at Goob, who is also leaving the orphanage with a family of his own and a Little League trophy. The movie ends with a quote by Walt Disney containing Lewis/Cornelius' motto: "Keep Moving Forward."