Answer :

AL2006
Every "warm-blooded" living thing needs a way to make heat and keep it
when its body is too cold inside, and a way to get rid of extra heat when
its body is too hot inside.

Moving around (using muscles) makes heat inside, and the animal needs
a way to get rid of the heat.  Fast.

Evaporation is a very effective way to get rid of heat.

Human animals do it by perspiring.  We excrete moisture through our skin,
and when the moisture evaporates, that takes heat away very efficiently.
That's why we like to fan ourselves when we're hot ... moving more air
past our skin makes moisture evaporate faster.

Dogs don't perspire, so they badly need another way to get rid of heat
in a hurry.

They do it through their mouth.  They put water in their mouth if it's available,
or else just collect a lot of saliva in there if there's no other water, and then
they blow air over it to evaporate it and get rid of heat.  Panting moves more
air over the moisture, which causes more evaporation and more heat loss.