Once upon a time, two new animal body plans were invented - OK, it was during the Triassic, 230 million years or so ago. They were, respectively, the prototypes of the mammals and the dinosaurs. Because the Triassic was notoriously low on oxygen, with maybe half the concentration of today, breathing was tough, and lots of the less talented perished. Mammals had an innovation, the diaphragm, which allowed walking and breathing at the same time, an advantage not enjoyed by lizards. Dinosaurs had another, a two cycle lung.
The mammalian lung is a cul-de-sac. Air comes in and leaves by the same path. The dino lung, though, is a sort of two cycle lung that separates inhaled and exhaled air except at the ultimate intake and exit. This lung, subsequently inherited by, among others, birds, is more efficient. At 5000 feet, the bird lung is about twice as efficient as the mammalian version. Given that during the Triassic and early Jurassic oxygen levels were more like those now found at 15,000 feet, this was a big advantage.
No animals were able to grow very large during the low O2 level days, but when levels rose later in the Jurassic, dinosaurs went to town, leaving their mammalian cousins in the dust.
By the end of the Jurassic the largest land animals of all time were common: dinosaurs were lords of all creation; tiny primitive birds and tinier primitive mammals hid in the lowest-rent districts in town.
At the beginning the seas were so bare that stromatolites had made a comeback, and the larger fish and predators were few indeed. By its end there was a veritable cornucopia of the most spectacular marine denizens to have ever populated the sea: long-necked reptilian plesiosaurs, dolphin-like ichthyosaurs, and splendid primitive fish—similar to the modern-day gar and sturgeon (both with strange body armor)—schooled among vast coral reefs and an ocean filled to exuberance with all manner of ammonites and their more squid-like relatives, the belemnites.
Ward, Peter. A New History of Life (p. 245). Bloomsbury Publishing. Kindle Edition.
And rule the roost they did, until they met a asteroid with their names on it.