Lewis is a young inventor and orphan. While longing for a family of his own, Lewis has grown saddened over the years as all his attempts to be adopted seem to have failed. As well, each and every invention he attempts to fashion meets with disaster.
One day, Lewis' thinking turns to his Mother, and why she chose to leave him on the orphanage's doorstep all those years ago. This leads Lewis to think that maybe deep within his mind, a memory of her still exists, and maybe with it, he can find his Mom and reunite with her.
Lewis then tinkers non-stop on a machine to unearth the memory deep in his mind. Unrealized to Lewis, the constant tinkering sleep-deprives his roommate, Mike Yagoobian (also known as 'Goob'). however, Lewis is too busy with his own work to realize the effect on the other boy.
While Goob goes to play on the school baseball team, Lewis takes his invention to the science fair. During the science fair, he runs into a strange boy named Wilbur Robinson, who cautions him to stay away from 'The Bowler-Hat Guy.' Lewis ignores this, and attempts to make his invention work. Unknown to him, the 'Bowler-Hat Guy' and his hat (a mechanical creation) sabotage the item, causing it to malfunction, sending Lewis sadly running back to the orphanage.
Once there, he encounters Wilbur again, who tosses Lewis into a strange machine, that then appears to take them into the future. Wilbur is amazed, and attempts to use the time machine to go back in time and find his Mother. However, the two boys end up crashing the time machine, which Wilbur took from his Father's lab without permission.
While trying to figure out what to do, Wilbur takes Lewis to the Robinson mansion, where the boy is introduced to the strange yet caring family, albeit always wearing some strange form of headgear (a fruitbasket, a hat, etc)
Meanwhile, 'Bowler Hat Guy,' and his mechanical hat, take Lewis' invention, and attempt to sell it to a local company. However, 'Bowler Hat Guy' has no idea how it works, and the hat (whom he calls Doris), decides they need to find Lewis to figure it out.
Going back to the orphanage, 'Bowler Hat Guy' encounters Goob, who due to sleep deprivation, lost the game, and suffered the wrath of his teammates. Goob explains that the orphanage's supervisor said he should move on, but 'Bowler Hat Guy' states that Goob should use that experience, and never forget it...much to Goob's confusion.
After searching more of the Orphanage, Doris calculates that Lewis must have went to the future with Wilbur Robinson, and the two head into the future with a time machine of their own.
Back in the future, Lewis is introduced to more of the Robinsons' house, and how Lewis' father, Cornelius, is a great inventor, having successfully perfected time travel. However, Cornelius' most recent time iteration was stolen by the 'Bowler Hat Guy,' and this explains why Wilbur is trying desperately to set things right.
At the same time, Doris infiltrates the house, and attempts to kill Wilbur, but not before finding that 'Bowler Hat Guy' has time-travelled back and forth through time, returning to the future with a Tyrannosaurus Rex.
The Robinson family and Lewis manage to take down the enormous beast, and the family is ecstatic. It is then that Wilbur lets slip that Lewis is an orphan, and the family unanimously approves...until Wilbur knocks the hat off, prompting Wilbur's mother, Franny, to declare that Lewis has to go back to his own time.
Hurt and upset that he has once again seemingly lost the chance to have a family of his own, Lewis walks away, but is then accosted by 'Bowler Hat Guy' and Doris, who promise that if he helps fix his machine, they'll take him back in time to find his Mom.
Taking Lewis to the orphanage (now an abandoned building), Lewis fixes the memory-scanning machine, but 'Bowler Hat Guy' has Doris tie Lewis up, going back on his promise.
It is then that 'Bowler Hat Guy' reveals that he is actually Mike Yagoobian. Goob explains how Lewis' tinkering kept him from sleeping properly, and resulted in him losing the baseball game at school. Goob channeled this into deep resentment towards Lewis, that ate away at him, and caused his bad mood to keep him from ever getting adopted. in that time, Lewis was adopted, and many years later, became known as Cornelius Robinson, the head of Robinson Industries.
Goob angrily tried to get revenge on Lewis, but his feeble attempts proved futile. It wasn't until meeting Doris, the robotic bowler hat (a rejected experiment of Lewis') came up with a plan of her own.
Lewis tries to get Goob to see that he (Goob) also shares some of the blame, since Goob was not able to move on from that baseball game loss, but Goob refuses to acknowledge this.