The diving reflex is a physiological response triggered by immersion in water that evolved to protect mammals from drowning. It is strongest in aquatic mammals, but it is also present in humans, and means that the airways can be protected so an animal can survive immersed in water for a period of time.
When a mammal is holding their breath and cold water hits their face, sensitive receptors in the nasal cavity relay the information to the brain via the trigeminal nerve. This triggers an abrupt decrease in heart rate and causes the non-major blood vessels to constrict to shift blood flow towards the most important organs – the brain and the heart. Like all reflexes, it is an involuntary and automatic response. Unable to hold their breath intentionally, babies can do so instinctively due to the diving reflex.