Unfortunately, the short answer is “a lot of different ways”. Fish are wildly diverse and sometimes distantly related, and that means that lots of them have evolved different solutions to their environmental challenges.
Fish in cold water can have slower metabolisms, more fat, proteins that function like antifreeze, or even different blood chemistry to allow them to survive cold temperatures. These generally cause those fish to overheat in warmer water, or even just don’t function as well when it’s warmer. Fish in warmer water generally lack these necessary adaptations to function in colder environments, so they need to stay in warmer ones. Some species, like tilapia, face wide ranges of temperature and so are able to survive in both very cold and very warm water with ease.
Latest Answers