Dinosaur comes from the Greek terms dienos (terrible) and sauros (lizard). Dinosaurs are their own category of animal, most closely related to birds and crocodiles. They come from a group of reptiles called Archosauromorphs. Lizards come from a distantly related reptile group called Lepidosauromorphs.
Dinosaurs (including birds) are, however, related to crocodiles. Now, lizards, dinosaurs, and crocodiles are all reptiles. (Yes, that does mean that, in terms of phylogenetics, birds are reptiles - no question about it). Reptiles (diapsids) split from mammals (synapsids) before dinosaurs and mammals proper even evolved.
There are two major groups of archosaurs; the bird line archosaurs, and the crocodile line archosaurs. Bird line includes birds, their extinct relatives and ancestors, dinosaurs, the closest relatives of those animals, silesaurs, and a related group, pterosaurs.