NOTE: Here is a really great spoiler, sent in by Nicholas.

The movie opens with a woman approaching an orphanage at night in the rain, holding her baby.  We do not see her face as she is wearing a hood.  On the orphanage steps, she kisses her baby and then puts it down, but suddenly looks up as if she’s heard a noise (important later).  We then see Mildred, the head of the orphanage, coming to the door to answer a knock (again, important) and finds the baby.  The movie cuts to thirteen years later. Lewis, the baby, has apparently become an avid inventor and is actually a genius – he teaches a class and takes college classes (we’ll find out later he graduated college at 14).  His roommate, “Goob”, is tiredly helping Lewis make yet another invention in his room.  Lewis is always building and keeps Goob up every night, which makes Goob’s little league baseball career suffer (VERY important).  Mildred comes to the room and tells Lewis that there is another family coming to adopt him.  The family and Lewis do not click, and when Lewis tries to show off his invention, a machine to automatically make the perfect PB&J, it explodes and the family leaves in a huff.

Mildred finds Lewis on the roof where he always goes to think, and when Lewis says that no one, not even his own mother, wants him, Mildred tells Lewis to stop living in the past and look to the future.  Lewis gets an inspiration: he’ll invent a machine to bring back lost memories so he can look back into his baby memories and see his mother.  Lewis invents this machine over the next couple of days and Goob is unable to sleep.  He complains to Mildred about this and says that he won’t be able to keep awake during the baseball game.  Lewis heads to the school science fair, telling Mildred that he’s given up on being adopted and will only settle for his real family. 

A hyperactive judge named Dr. Krunklehorn is looking at all the science experiments.  She is an inventor, having invented the caffeine patch which is the power of at least 12 cups of coffee, and has them all over her body.  Lewis is approached by a young boy (we’ll find out later he is Wilbur Robinson) who claims he is a time cop from the future and that a man with a bowler hat stole a time machine, came to this time, and is after Lewis.  Lewis doesn’t believe him and Wilbur gets distracted, allowing Lewis to set up.  However, the sinister Bowler Hat Man lurks in the shadows nearby and sends his hat, a spider-like robot with mechanical arms, to sabotage Lewis’s machine.  Lewis is about to demonstrate the machine, but Wilbur, suddenly spots the bowler hat and tries to stop Lewis but the machine explodes and the science fair is in chaos.  Lewis runs out and leaves his machine, which the Bowler Hat Man steals.

At the orphanage, Lewis goes up on the roof, crushed.  Wilbur appears and tells Lewis to go back to the science fair and fix the machine, but Lewis refuses, especially when Wilbur goes into his “I’m a time cop from the future” speech again.  Wilbur then says that if he can prove he’s from the future, Lewis will go back to the science fair and fix the machine.  Lewis agrees . . . and Wilbur pushes him off the roof.  Lewis lands on top of an invisible flying time machine, and Wilbur uses it to take him to the future.  Soaring through a world of flying cars, clean cities, robots, and machines, Lewis finally believes Wilbur and Wilbur is happy – but Lewis then says that he wants Wilbur to use the time machine to take him back to the day he was left at the orphanage so he can stop his mother from leaving him.  When Wilbur refuses, Lewis grabs the steering wheel and crashes.  Wilbur is devastated – there are only two time machines in existence, both made by Wilbur’s dad, and now one is destroyed while the Bowler Hat Man has the other.  The two make a deal: if Lewis fixes the time machine, Wilbur will use it to take him back to see his mother.  They smuggle the machine into Wilbur’s garage where Carl, the melodramatic family robot, yells at Wilbur.  They tell Lewis to not leave the garage and hide his hair under a hat covered in fruit (if anyone sees his hair, they’ll apparently know he’s from the past) and tell him to fix the machine before Wilbur’s father returns in the morning.  In private, Carl says that Wilbur shouldn’t have brought Lewis back, and that because he did there is a break in time and Wilbur could be erased.  Downstairs, Lewis accidentally steps into an elevator and gets transported out of the house.

Back in the past, the Bowler Hat Man is talking with his hat, Doris.  The two plan to take credit for inventing the memory machine.  In fact, this is on Bowler Hat Man’s written checklist of things to do: steal a time machine, steal an invention, and pretend that he invented it.  We see for the first time that Bowler Hat Man is actually an idiot and Doris is the brains of the operation.  Bowler Hat Man is thrown out on his face because he doesn’t know how to use the machine.  Bowler Hat Man goes to Lewis’s room to kidnap him (literally, on his list, “get that boy”) but finds an injured Goob there instead.  He fell asleep during the baseball game while on the field, which cost them the game, and all the kids beat him up for it.  Bowler Hat Man gets very emotional and gives Goob a speech about holding the sadness inside and converting it to rage.  On the roof, Doris finds traces of Wilbur’s time machine and the two head to the future to track down Lewis.

Lewis, while this is going on, is wandering around the Robinson house.  He meets Lefty, the octopus butler, and Grandpa Bud, a crazy man looking for his dentures and wearing his clothes backwards.  Bud takes Lewis on a tour of the house while Wilbur goes on a frantic search for them.  In the house, a topsy-turvy funhouse full of strange gadgets and passageways, Lewis meets the family.  He meets Uncle Gaston, shooting himself from a cannon to race Aunt Billie’s life-size toy train.  Cousin Tallulah, wearing a skyscraper dress, is fighting with her brother Laszlo, flying around on a jetpack and painting the walls.  Billy’s husband, the obese Uncle Joe, sits in his chair all day.  Uncle Art delivers pizzas in a flying saucer like a superhero.  Bud’s wife, Lucille, is dances to disco music and Uncle Fritz, a spacey middle-aged guy, argues with his wife – a ventriloquist puppet named Petunia.  Finally, Lewis meets Wilbur’s friendly mother, Franny, conducting her frog jazz band.  The lead frog, Frankie, is wearing Bud’s teeth.  The entire family loves Lewis, but Wilbur sneaks in and takes him downstairs.  We find out that Wilbur’s father Cornelius is a master inventor and invented practically everything, coining the motto “Keep moving forward”.  Lewis attempts to fix the time machine but it breaks again.

While this is going on, Bowler Hat Man and Doris try to sneak into the house.  Doris spawns a miniature bowler hat which the Bowler Hat Man controls.  Mini-Doris finds and takes control of Frankie.  At dinner, Lewis pretends to be an exchange student from Canada (now North Montana).  Franny is extremely nice and Lewis finds himself loving everyone very much, but when Franny goes to remove Lewis’s hat, Wilbur initiates a kung-fu style meatball fight between Franny and Laszlo (FUNNY).  Lewis, sad, says that he is an orphan and wishes that if he had a family they would be like the Robinsons. 

For dessert, Carl is about to serve PB&J sandwiches with a machine similar to the one Lewis made earlier.  When it breaks, Wilbur decides to get Lewis to fix it to raise his confidence, but Lewis fails – and the entire family applauds the failure, saying that a failure means you can try again.  Frankie enters, but he’s just a small frog and can’t seize Lewis.  Bowler Hat Man gets rid of Frankie and sees a hedge shaped like a T-Rex in the garden.  He takes the time machine back to the past and returns with a real one.  The entire family uses their machines and vehicles to stop the T-Rex (for some reason called Tiny) but the T-Rex turns the tables and corners Wilbur and Lewis.  Tiny is about to eat Wilbur but Lewis throws a shovel in his mouth to stop him, and Wilbur knocks the hat off Tiny’s head.  Frankie and the other frogs dispose of the tiny hat, mob style.

Everyone is now hurt but also in love with Lewis.  Wilbur is worried, and when Lewis thanks everyone but says he has to go, Franny breaks down and says that she wants to adopt Lewis (apparently she was sad that he was an orphan).  Wilbur quickly knocks Lewis’s hat off and when everyone sees his hair, they are horrified.  Franny takes back her adoption offer at once and says Lewis has to go.  Wilbur explains the situation with the time machines and also blurts out that he never meant to take Lewis back to his mother.  Lewis runs away, saying he won’t trust the Robinsons ever again.  Everyone is furious with Wilbur.  Lewis is approached by the Bowler Hat Man and Doris and told that if he fixes the memory machine, they’ll take him to see his mother.  Wilbur rushes up and Lewis, still angry with him, flies off with Bowler Hat Man.

In a dark room somewhere, Lewis repairs the memory machine and explains how to use it.  He is then tied up by Doris and Bowler Hat Man turns on the lights – they are in Lewis’s old room at the orphanage.  Bowler Hat Man reveals his identity at last: GOOB!  After Goob lost that game, he went into long-term depression and remained an orphan.  Over the years, Goob decided that his bad life was Lewis’s fault.  At the same time, Wilbur’s father invented Doris but Doris had a mind of her own and wanted to take over the world, so he shut her down.  Doris escaped and found Goob.  The two of them decide to steal Mr. Robinson’s time machine and go back in time to steal Lewis’s first working machine.  Lewis suddenly figures out why they are attacking him to hurt Mr. Robinson – Lewis IS Mr. Robinson.  This is why Franny recognized him and said that he had to go back to the past and also why Wilbur believes Lewis can fix the time machine.  If Lewis doesn’t invent the memory machine, the future will be destroyed.  Lewis realizes that by not letting go of the past and not looking towards the future, Goob’s anger destroyed him; the same way Lewis was letting his anger about his mother ruin his own life.

This is where things begin to get a bit creepy.

Carl and Wilbur invade the orphanage and rescue Lewis and the memory machine.  Wilbur realizes that the jig is up.  They are friends again but just as they reach the Robinson house, Doris shows up and kills Carl (yes, really kills him).  Goob steals the memory machine and goes back to the past in his time machine.  Wilbur begs Lewis to fix the other time machine and go back to the past to stop him, but it is too late.  In the past, Goob successfully demonstrates the memory machine.  Time is broken and Wilbur is suddenly (and violently) dragged out of existence.  The future is destroyed and Lewis finds the Robinson house empty.  On a television screen, Lewis sees that after taking the credit for the memory machine, Goob takes Doris’s advice and mass produces her.  The Doris hats then destroy the cities, make mind slaves of humanity, and Doris kills Goob (again, yes, really kills him).  Doris was behind this entire scheme all along.

Possessed by Doris hats, the Robinsons appear and attack Lewis.  Lewis climbs into the time machine and the family tries to push it off a ledge when Lewis figures out how to fix it and flies away, but the entire Robinson house, a giant Doris, chases him.  Millions of Doris robots come after him and we see that the entire human race has been enslaved.  Cornered by the Robinsons, Lewis angrily says “I wish I’d never invented that stupid hat!”  He suddenly realizes what to do and flies into the past to the boardroom where Goob is about to take credit for Lewis’s invention.  Lewis tells Goob what Doris is up to and Doris throws herself at Lewis, but he looks straight at her and says “I’m never going to invent you.”  Doris dissolves into pieces.

Taking Goob with him, Lewis returns to the future and sees it rebuilding itself.  The Robinsons are restored and Wilbur and Carl are brought back to life.  Lewis explains and tells Wilbur to adopt Goob, but Goob is gone.  Lewis looks down and sees Goob’s checklist with all the previous objectives crossed out, but there is a new entry: “?”  We see Goob walking off sadly in the distance.

Lewis reunites with the Robinsons.  He is happy to have found his family at last.  Cornelius (the future Lewis) returns.  He takes Lewis to his lab and we see the tremendous success Lewis will become.  Lewis climbs back into the time machine with Wilbur and promises to make things right.  He says goodbye to the Robinsons, but Wilbur goes to the night Lewis' mother left him at the orphanage.  This is dangerous as Lewis could undo history at this moment.  He gets out of the time machine and is about to talk to his mother as she puts the baby down, but stops, realizing that he already has a family.  He slips on the stairs and hides – that moment during the opening when the mother thought she heard a noise.  The mother leaves and we see that it is Lewis who knocks on the door of the orphanage, not his mother.

Lewis returns to the day of the science fair and says goodbye to Wilbur, but says that he will never forget him.  Wilbur jokingly tells Lewis that he’ll will keep coming back until he gets things right.  On the way to the science fair, Lewis stops by Goob’s baseball game and wakes him up in time to catch the winning point.  At the fair, Lewis demonstrates his machine to Dr. Krunklehorn again, but this time it works and we see the memories of her wedding – to Bud.  Lewis realizes that Dr. Krunklehorn is Lucille from the future, his foster mother-to-be.  At the same time he bumps into a young Franny, who says that she is training her frogs to sing but no one believes she’ll do it.  A young Uncle Gaston asks Lewis if he can write a story about him.

We then see everything is now fixed.  Lewis is adopted by Lucille and Bud and leaves Mildred and Goob, now a good friend, at the orphanage.  They move into a large observatory which will one day be the Robinson residence.  Lewis sees the empty room that will be filled with all his inventions and gets to work.  The last thing we see is Lewis building the robot that will one day be Carl.