Fish are cold-blooded creatures, and most of them cannot control their internal temperature, like humans. In order to stay at a healthy temperature, or obtain temperature homeostasis, the fish seek warmer or colder water. Some fish also have additional mechanisms to keep a healthy temperature.
Fish, like all animals, create heat from metabolic activity. Metabolic activity includes breaking down food and movement.
Fish lose metabolic heat through their gills. This happens because the heated blood that runs though vessels in the gills comes into close contact with the colder water outside, and the heat is lost to the water.
Most fish are poikilothermic, which means their body temperature changes with ambient temperature. In this case, it refers to the temperature of the water around them. Poikilothermic fish control this by moving from colder water to warmer water. An example of this is when a fish moves to the bottom of a pond when the top of the pond is frozen over.
Exceptions to Pure Poikilothermy
Certain fish, such as sharks and tuna, can control their body temperature using a paired blood vessel system, where warm blood going to the gills swaps heat to colder blood coming back from the gills, thereby keeping a higher blood temperature than pure poikilothermic fish.