In Age of Mythology, the T-Rex isn't part of the standard roster, so getting one into your game typically involves extra content rather than a normal in-game unlock. Some players have turned to community sites and mods to add the dinosaur to their copy.
If you go that route, be careful to download only from reputable sources, since mods and "unlock" downloads from unknown sites can carry risks. Reading up on a trusted community's instructions is the safest way to try it.