Dinosaurs dominated the Earth for over 150 million years, longer than any other group of animals. But it has only been recently that fossil discoveries have helped us trace the story of how these animals first appeared.
Herrerasaurus. Chicago Field Museum
The Dinosaurs are an evolutionary offshoot of a group of reptiles called Archosaurs ("ruling lizards"), which contain the modern crocodiles and also the extinct pterosaur flying reptiles and the marine plesiosaurs. The Archosaurs reached the peak of their diversity during the late Permian and early Triassic periods, when a large number of crocodile-like animals, including plant-eaters and even some meat-eaters that walked bipedally on their hind legs, dominated the landscape. The Archosaurians are separated from the ordinary reptiles (lizards, turtles and snakes) by a number of technical features in their skeletons, the most important of which is the hip structure which allows the legs to extend straight down from their pelvic joints rather than splayed out to the side, allowing them to carry their body weight directly above their feet. (Modern crocodilians can still do this when they want to move in a hurry, using what is called the "high walk"). The Archosaurs were one of the few large animal groups that survived through the Permian Extinction that wiped out some 90% of all Earth life.
The Dinosaurs form a distinct group within the Archosarians, characterized by some further skeletal specializations. They are themselves split into two distinct groups: the Saurischians ("lizard-hipped") include the carnivorous Theropods and the giant plant eating Sauropods. The Ornithischians ("bird-hipped") include most of the plant-eaters like duck-billed and horned dinosaurs. The Saurischians appeared first, and the Ornithischians evolved from them later (and despite the name, the modern birds are actually descended from lizard-hipped, not bird-hipped, theropods).
The earliest Dinosaurs, then, would have been Saurischian theropods, evolved from crocodile-like Archosaurs. But the Dinosaurs share so many of the characteristics found in Archosaurs, including the straight leg joints which make bipedal walking possible, that it can be quite difficult to determine whether a particular species was actually a "Dinosaur" or a very advanced "Archosaur". Some paleontologists therefore use a cladistic definition based on ancestry, and define "Dinosaurs" as "the last group to share a common evolutionary ancestor with birds and ornithischians." The arcania of Dinosaur definitions has led to a great deal of dispute about which early species were actually "Dinosaurs" and which were still "Archosaurs". Given that evolution happens in a smooth grade from one to the other, and does not have any sharp dividing line, that should be no surprise. But nobody disputes the fact that the earliest Dinosaurs evolved from Archosaurs.
The earliest species that has been generally accepted by paleontologists as a true Dinosaur was first found in 1958 in northwestern Argentina. Named Herrerasaurus, it was fragmentary and incomplete, and unfortunately not much could be learned from it. Then in 1988 a complete skull and some other bones, including parts of the rear limbs, were found near the same location, and the fossil's significance became clear. The limb bones showed that it was bipedal and the sharp serrated teeth showed that it was a carnivorous meat-eater. It also had the lizard-hipped configuration found in both the Archosaurs and the Dinosaurs. Measuring about 15 feet from nose to tail and weighing around 650 pounds, Herrerasaurus would have been a formidable hunter. (But not, however, at the top of the food chain: some of the bones have tooth marks from large crocodilian Archosaurs, showing that at this early stage, Dinosaurs were themselves still prey for bigger hunters.)
But what was most interesting about Herrerasaurus was its age: the fossils dated to about 230 million years ago, during the late Triassic period. This would place it at right around the time that the Dinosaurs first split away from the Archosaurs, and Herrerasaurus itself displayed skeletal features in the skull and limbs that were found in both groups, indicating that it was right on the dividing line. Indeed, for many years there was fierce debate among paleontologists whether Herrerasaurus was actually a Dinosaur (in the Theropod group, and therefore ancestral to later Theropods like Allosaurus and Tyrannosaurus), or should still be classed with the Archosaurs. And some paleontologists took a middle view, that Herrerasaurus was a Theropod Dinosaur, but was already a specialized side branch and was not ancestral to any of the later Dinosaurs.
The debate was largely settled in 2009, when paleontologists published a description of a new set of skeletons found in New Mexico and called Tawa. These are of a small slender carnivorous Theropod about seven feet long nose to tail, which date to about 215 million years ago, making them a bit younger than Herrerasaurus. But the Tawa fossils shed significant light on where Herrerasaurus fits into the story of dinosaur evolution. Many of the earlier skeletal characteristics found in Herrerasaurus are also seen in Tawa, confirming that Herrerasaurus was not just an offshoot of the Archosaurs, but was indeed an ancestral Theropod Dinosaur.
Further, the Tawa fossils were found together with two other small Theropod Dinosaur species. When these were examined, it was found that the three species were not closely related to each other, but all three were closely related to an earlier theropod that had been found in South America. This indicated that the Theropod line had most likely originated in what is now South America (where Herrerasaurus was found) and then spread out from there into the surrounding areas--and the differing Theropods found in the same place indicated that this dispersal outwards had happened repeatedly over time. And the presence of skeletons from primitive ornithischians and protosauropods, found near the location of Herrerasaurus but slightly afterwards in time, indicates that once the earliest Theropod Dinosaurs appeared, they rapidly diversified into the three major branches of Dinosaurs, which would go on to dominate the entire Mezosoic era of life on Earth.