This is a surprisingly common idea, and it really needs to be squashed. Crocodiles, like Dinosaurs, are Archosaurs. These are a type of reptile, quite distinct from the other types. They became big after the massive Permian-Triassic extinction event, and dinosaurs were just one of many types. They only really took off after the Triassic-Jurassic extinction event wiped away most non Dinosaurian Archosaurs. Crocodilians were a prominent survivor however.
Ironically, the main distinguishing feature of an Archosaur is it's erect hip joints, similar to mammals, but crocodiles have gone back to the sprawling hips of lizards. They're still obvious archosaurs however, due to dozens of more minor factors.