One of the problems with explaining the scientific definition of the word "dinosaur" is that biologists and paleontologists tend to use much drier, more precise language than your average dinosaur enthusiast on the street (or in an elementary school). So while most people intuitively describe dinosaurs as "big, scaly, dangerous lizards that went extinct millions of years ago," experts take a much narrower view.
In evolutionary terms, dinosaurs were the land-dwelling descendants of the archosaurs, egg-laying reptiles that survived the Permian-Triassic extinction event 250 million years ago. Technically, dinosaurs can be distinguished from the other animals descended from archosaurs (pterosaurs and crocodiles) by a handful of anatomical quirks. Chief among these is posture: Dinosaurs had either an upright, bipedal gait (like that of modern birds), or if they were quadrupeds, they had a stiff, straight-legged style of walking on all fours (unlike modern lizards, turtles, and crocodiles, whose limbs splay beneath them when they walk).
Beyond that, the anatomical features that distinguish dinosaurs from other vertebrate animals become rather arcane; try on an "elongate deltopectoral crest on the humerus" for size (i.e., a spot where muscles connect into the upper arm bone). In 2011, Sterling Nesbitt of the American Museum of Natural History attempted to tie together all of the subtle anatomical quirks that make dinosaurs dinosaurs. Among these are a radius (lower arm bone) at least 80% smaller than the humerus (upper arm bone); an asymmetrical "fourth trochanter" on the femur (leg bone); and a large, concave surface separating the "proximal articular surfaces" of the ischium, aka the pelvis. With terms like these, you can see why the "big, scary, and extinct" is more appealing to the general public.
The First True Dinosaurs
Nowhere was the line dividing "dinosaurs" and "non-dinosaurs" more tenuous than during the middle to late Triassic period, when various populations of archosaurs had just started to branch off into dinosaurs, pterosaurs, and crocodiles. Imagine an ecosystem filled with slender, two-legged dinosaurs, equally slender, two-legged crocodiles (yes, the first ancestral crocs were bipedal, and often vegetarian), and plain-vanilla archosaurs that looked for all the world like their more-evolved cousins. For this reason, even paleontologists have a hard time definitively classifying Triassic reptiles like Marasuchus and Procompsognathus; at this fine level of evolutionary detail, it's virtually impossible to pick out the first "true" dinosaur (though a good case can be made for the South American Eoraptor).
Saurischian and Ornithischian Dinosaurs
For the sake of convenience, the dinosaur family is divided into two main groups. To vastly simplify the story, starting about 230 million years ago a subgroup of archosaurs split off into two types of dinosaurs, distinguished by the structure of their hip bones. Saurischian ("lizard-hipped") dinosaurs went on to include predators like Tyrannosaurus rex and huge sauropods like Apatosaurus, while ornithischian ("bird-hipped") dinosaurs consisted of a diverse assortment of other plant-eaters, including hadrosaurs, ornithopods, and stegosaurs. (Confusingly, we now know that birds descended from "lizard-hipped," rather than "bird-hipped," dinosaurs.) Learn more about how dinosaurs are classified.
You may have noticed that the definition of dinosaurs provided at the start of this article refers only to land-dwelling reptiles, which technically excludes marine reptiles like Kronosaurus and flying reptiles like Pterodactylus from the dinosaur umbrella (the first is technically a pliosaur, the second a pterosaur). Also occasionally mistaken for true dinosaurs are the large therapsids and pelycosaurs of the Permian period, such as Dimetrodon and Moschops. While some of these ancient reptiles would have given your average Deinonychus a run for its money, rest assured they weren't allowed to wear "dinosaur" name tags during the school dances of the Jurassic period.