"Tyrannosaurus Gadget" is the 16th episode of the second season of Inspector Gadget.
Dr. Claw and Thelma show Gadget's family tree. Thelma says that if they can destroy one of Gadget's ancestors, he'll never be born. She reveals her time machine and decides that Gadget's first ancestor will be done for by dinosaurs. Claw also decides that the dinosaurs will destroy Metro City.
While visiting the museum, Gadget receives another assignment from Chief Quimby: He has to go back in time to stop M.A.D. agents from bringing dinosaurs to Metro City. Professor Von Slickstein shows Gadget the time machine that he can use to travel back in time and the inspector allows Penny and Brain to come along.
The Gadget clan activates the time machine and they go back in time, but they end up in the wrong era. After a brief encounter with cavemen, Gadget saves a caveman from a saber-toothed tiger. The man whom Gadget saved turns out to be Gadget's first ancestor, who looks exactly like Gadget, except for caveman clothes, a beard, and a caveman accent. He also has a niece who's a cavegirl version of Penny and a dog who looks like Brain, but is more of a mammoth than a dog.
Meanwhile, at the Mesozoic era, Thelma and two M.A.D. agents manage to catch 3 Brontosaurs and then use the time machine to travel to the same era where Gadget is. Seeing Gadget there, Thelma sends the dinosaurs to destroy him. Upon seeing a dinosaur, Gadget tries to say hello. Without Brain, Cave Gadget, and Cave Brain's help, Gadget could've been smashed by dinosaurs. The inspector ends up in a swamp and is then rescued by Brain. Gadget picks up some fruit and is caught by a herd of mammoths. Gadget feeds the mammoths with the fruit and they like it. Upon seeing Brontosaurs, the mammoths charge at them. A small mammoth is left behind and Gadget soon makes friends with it. Thelma's time machine is then smashed by the mammoths, making her and the dinosaurs unable to go back to their times. Cave Gadget, Cave Penny, and Cave Brain have destroyed the time machine, making the Gadget clan from the 20th century unable to return to present. The dinosaurs then arrive and Gadget tries to have fun with them while Thelma and the M.A.D. agents try to get rid of him. This fails and Gadget, Cave Gadget, and Cave Brain seem to be distracting the dinosaurs. With the mammoth's help, Penny manages to fix the time machine while Cave Penny picks up some fruit, which are wired to the time machine. Penny feeds them with the fruit, then activates the time machine and brings the dinosaurs back to Mesozoic era. It is now time to say goodbye and Brain receives a bone from Cave Brain and Penny receives a necklace from Cave Penny. Gadget receives a smooch on the cheek from the mammoth and, in return, Gadget gives the mammoth the fruit. It is time to return to 20th century, but Thelma and the M.A.D. agents appear in front of the time machine, begging the Gadget trio to bring them back. Gadget grabs them with machine hands and everyone goes back to 20th century. The time machine, however, appears in the museum, but Quimby is also there to congratulate Gadget for a job well done and Thelma and the M.A.D. agents are arrested by him.