The reason why you feel so good after being in the ocean is due to a result of mix of brain chemistry changes, sensory input and the blue space effect.
When you're in the ocean, the salty air, rhythmic waves and the vast blue views lower your stress hormones, like cortisol, while also your happy hormones of serotonin and dopamine, which also promotes relaxation as well as improve your mood, and connecting you to nature, which also creates feelings of awe and well being.
Ocean air is also rich in negative ions, which increase serotonin, which boosts your energy and mood.
Being near the water also lowers your cortisol, also known as your stress hormone levels.
And physical activity like swimming releases endorphins, which are natural mood lifters.
And water immersion can also decrease catecholamines which are fight or flight hormones, and balances them, which is similar to meditation.
The predictable sound of waves of the ocean calms the brain, reducing anxiety.
Vast blue spaces (ocean, sky) are linked to higher life satisfaction and mental well-being.
The ocean's scale provides a sense of awe, putting problems in perspective and making you feel part of something bigger.
Us humans have an innate connection to nature, so natural environments like the ocean feel instinctively soothing.
Saltwater contains minerals like magnesium, which promotes relaxation and reduces inflammation.
Breathing in sea air increases oxygen absorption.
The color blue itself is psychologically calming, lowers blood pressure, and promotes clear thinking.