Michael Crichton never described Tyrannosaurus rex as anything but dangerous in his two novels, Jurassic Park and The Lost World, but director Steven Spielberg took certain liberties and instilled more character into this monstrous reptile in the movies which bore the same names (1993 and 1997 Universal Pictures).
Let me say right away that the introduction of T. rex into the first movie remains one of the greatest reveals of a monster in cinema. Rex tries (unsuccessfully, whew) to kill children trapped in an electrical car during a thunderstorm while the power is out.

So, this dinosaur starts out as bad but then kind of turns good by the end of the movie.
It does battle with the Velociraptors and thereby saves the humans by giving them time to escape.
Ah, but in The Lost World: Jurassic Park, Rex is evil again, killing lots of people, eating a family dog, and wrecking San Diego. Bad Rex!
But wait, it’s okay! The adults were only trying to protect their offspring, and the happy family is reunited.
In Jurassic World (2015 Universal Pictures, directed by Colin Trevorrow), the T. rex once again gets to play the hero by doing battle with Indominus rex, thereby saving more humans.
These roles of harming and helping humans were also played by the gods in Greek mythology. In this respect, our dinosaur friend becomes something of a fickle and very big, reptilian god.
Good boy, Rex! Good boy!