As it was explained to me (and from reading I have done), the mammalian diving response (which all mammals have but to varying degrees) works to preserve oxygen and energy expenditure when underwater.
For seals and other water dwelling mammals this is a controlled sophisticated mechanism that is deliberately used when underwater.
In humans it is a survival mechanism, triggered when the trigeminal nerve on our face gets submerged in water. And the colder it is the stronger the response seems to be.
Submerging one self in cold water up to your head seems to affect many parts of the human body, and in my case I am not sure which part it is that I am feeling the effects of. But it leaves me feeling more alert, awake and with less mindfog after doing an extended cold water dip (going to the pool without one in comparison leaves me sluggish).
I don't know if this related to this effect or not but I've noticed that it's much much easier holding your breath for a longer period of time when you're in a swimming pool than outside.