The Time Machine is a device created by Cornelius Robinson in Meet the Robinsons. Two of them were built: Time Machine #1 was a prototype made from a regular flying car that Wilbur Robinson used. Time Machine #2 was stolen by Bowler Hat Guy after he met DOR-15.
Time Machine 1 was used to go back in time by Wilbur from the deepest level of the prototype section with maximum security from Robinson Industries after he left the garage door unlocked. He went to the day when Lewis would manage to have his first invention work despite messing the future. It was stolen by Queen Lizzie's ant army and later Emperor Stanley's Magma Industries army. Wilbur then recovered it and after destroying Mega-Doris, went back to the science fair the second time. He then flew it to the orphanage to get Lewis to come to the future with him.
Time Machine 2 is stolen by the Bowler Hat Guy, or Goob, to aid Doris's scheme for revenge. He uses it to travel back to the day of the Science fair to sabotage Lewis's Memory Scanner, making him abandon it so they could steal it. Unfortunately, they lacked knowledge of how to operate it during their presentation at Inventco, so they decide to find Lewis to learn how and upon learning that Wilbur took him to the future, they used their Time Machine to follow them.
In the future, Lewis crashes Time Machine 1 after fighting with Wilbur when he realized he can go back and stop his biological mother from abandoning him as an infant. The two managed to push the wreckage back to the Robinson household to repair it, without success.
Meanwhile, while Doris infiltrated the Robinson household, Goob took Time Machine 2 back to the dinosaur era to bring back Tiny the T-Rex to capture Lewis. When that failed and Lewis learned that Wilbur never intended to bring him back to see his mother, Goob and Doris pick him up with another false promise to get him to fix the Memory Scanner. Though Lewis escapes, Goob and Doris use Time Machine 2 to go back to the past for a second chance at impressing Inventco.
As the future changed around Lewis, he found his Memory Scanner, which displayed a video of Goob successfully impressing Inventco and thus began the mass production of helping hats, which Doris uses to enslave humanity, to Goob's horror, before Doris sics a number of hats against him. As soon as the recording stops, he is attacked by Doris and the hat-controlled Robinsons. Taking cover inside Time Machine 1, Lewis managed to repair it. He manages to flee Doris' lair, which then sprouts legs and starts pursuing him through the industrial, polluted future where humanity are enslaved to robotic hats. Eventually cornered by the giant hat and swarms of hats, Lewis then realize that since he invented Doris, he can un-invent her. Using the time machine, he returns to the past, to the point where Goob signs his contract with Inventco and reveals Doris' planned betrayal. Doris then attempts to attack her creator, but Lewis simply swears never to invent her, causing Doris to vanish into non-existence. He then brings Goob back to the future to show him Doris' future, which soon changes back into the peaceful, idyllic future.
After Lewis reconnects with his future family and meets his future self, Cornelius Robinson, he rejoins Wilbur to return to his past. However, instead of returning his father to the Science Fair to put everything back in order, Wilbur takes him back to see his mother. However, Lewis decides against changing this part in his life, realizing he already has a family: the Robinsons. After returning to his proper time, Lewis shares a goodbye hug with Wilbur, who then writes "See ya later dad" in the sky before turning to his time.
What happens to Time Machine 2 is unknown, but since Lewis prevented Goob's transformation into the Bowler Hat Man, and refused to create Doris, presumably the theft of Time Machine 2 is erased and the vehicle is returned to its proper place in the Robinson household.