Crocodilians are first found in the Upper Cretaceous period. They are descendents of a much wider group of archosaurs called the crocodylomorphs. These, in the Upper Triassic, were slender land-living animals.
The crocodylomorphs, in turn, were part of an even larger group, the Crurotarsi, which are first seen early in the Triassic.
Crocodilians are the the sister group of the dinosaurs. This means crocodilians are the closest living relatives to birds. They are both survivors of the Archosauria.