Lewis is an aspiring 12-year-old inventor at an orphanage whose inventions have been scaring off potential parents. He decides that his mother, who abandoned him at the orphanage as an infant, is the only one who ever truly loved him and works on a machine to scan his memory to locate her. Taking his memory scanner to his school's science fair, Lewis meets 13-year-old 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 afterwards. 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, who is away on a business trip. 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 admits to lying to Lewis about taking him back to see his mom, causing Lewis to run off in disgust.Lewis then discovers that Cornelius Robinson is, in fact, a future version of himself, and Wilbur is his future son. Lewis also finds out that the Bowler Hat Guy is a grown-up version of Lewis' roommate, Michael "Goob" Yagoobian. Because he was always kept awake by Lewis doing his projects, Goob fell asleep during an important Little League game. After failing to make an important catch that cost their game, the teammates had beaten him up. Goob became so bitter as a result, 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 who mind controlled the human population into slavery. In a video camera, it is shown that Goob is betrayed and shocked by Doris' takeover of everyone and is presumably killed 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. After persuasion from Lewis, Wilbur tries to ask the adult Goob to join the family, but he has disappeared, apparently ashamed at what he has done.Back in Wilbur's time, Lewis finally meets Cornelius face to face. 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 the moment when his mother abandoned him. Lewis nearly stops her from leaving his infant self 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 en route wakes up Goob just in time for him to make the winning catch, changing his future. 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 nicknames him "Cornelius" and takes 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 film ends with a quote by Walt Disney containing Lewis/Cornelius' motto: "Keep Moving Forward."
Output: Question: Where does lewis return to?, Answer: Science fair