Eight million years ago, soft, boneless creatures first evolved into fish with internal skeletons. Fish then evolved into terrestrial amphibians, and subsequently into reptiles. One branch of these reptiles evolved into archosaurs.

The earliest dinosaurs were small, bipedal carnivores, but large, quadrupedal herbivores also evolved at the end of the Triassic period. During the Jurassic and Cretaceous periods, dinosaurs diversified into a large number of large and small carnivores, bulky herbivores, small, fast-moving herbivores, and other groups with large bony plates, horns, plates, and hammer-like defensive organs.
All dinosaurs originated from the order Cochleodontia, a type of archosaur. The explanation for the upright walking of dinosaurs is that the earliest archosaurs lived on plateaus and were small or medium-sized carnivores. Because they needed to run nimbly to catch prey, archosaurs developed different postures, and one branch of them gradually became upright dinosaurs.
Speed was crucial for capturing prey, and the body was lifted by the forelimbs, allowing the tail to function effectively as a balancer and achieve an upright posture. The entire body, centered around the pelvic girdle, evolved into a unique reptilian form characteristic of dinosaurs. This development was largely completed in the Early Triassic period.
The Mesozoic Era, the second geological era of the Phanerozoic Eon, spans from 250 million to 65 million years ago. It is the era between the Paleozoic and Cenozoic, and is geologically divided into three periods (Triassic, Jurassic, and Cretaceous). This era was the most dominant period for reptiles on Earth.
Dinosaurs, the representative animals of the Mesozoic Era, appeared in the Late Triassic, flourished in the Jurassic and Middle Cretaceous, and went extinct 65 million years ago in the Late Cretaceous. Because the most abundant and representative species on Earth at that time were dinosaurs (who ruled the Earth for about 160 million years), the Mesozoic Era is also known as the Age of Dinosaurs.