Birds and humans have a four chambered heart. All animals having 4-chambered hearts are warm-blooded. Why are crocodiles an exception? Why are they cold-blooded even though they have a 4-chambered heart?
The short answer is crocodiles may be secondarily cold blooded, but the long answer is warm blooded and cold blooded is not a binary condition but a spectrum.
It has to do with how much heat you generate with your own tissue as all organisms generate some heat and gain some from the environment when they can. on one end you have extreme ectotherms (some insects) at the other extreme endotherms (such as arctic mammals) and a huge range between them covering nearly every level of metabolic activty. The ancestors of crocodiles (Crocodylomorpha) were terriestial and highly active and was thus likely near the warm blooded end of the spectrum and thus with a four chambered heart. They actually look like what you would get if you tried to turn a crocodile into a wolf. But it is believed that as the line that led to modern crocodiles adapted more for an aquatic environment they switched back to a more ancestral metabolism. Although I should mention crocodiles and esspecally alligators are capable of producing considerable metabolic heat and activity even for prolonged period, more than other "reptiles", comparable to slowest metabolism mammals. they kep many anatomical adaptation to a higher metabolism as they also aid in diving and still benefit their higher metabolisms.