They both share a common ancestor called Archosaur, but then evolved separately. Theres a decent high level description of that here, but the key part is:
Crocodiles and dinosaurs share a deeper connection than most people realize, both belonging to the group Archosauria, which emerged approximately 250 million years ago. This relationship makes crocodiles more closely related to birds (the surviving dinosaur lineage) than they are to other reptiles like lizards and snakes. The archosaur lineage split into two main branches: the Pseudosuchia (crocodile line) and the Avemetatarsalia (dinosaur and pterosaur line). During the Triassic period, both groups flourished and diversified, producing a remarkable array of body forms and ecological adaptations. This shared heritage explains certain similarities between crocodilians and dinosaurs, including their four-chambered hearts, complex respiratory systems, and parental care behaviors—traits that distinguish them from other reptile groups.
Klear@piefed.world 8 hours ago
Children of your sister are not your descendants (at least I hope they are not!), although you share a common ancestor with them. All humans share a common ancestor, but not all humans are descended from all other humans.
Crocodiles and dinosaurs (and birds) do share a common ancestor, but that ancestor was neither crocodile, nor a dinosaur.
Does that make sense?