My first memory of the sea: slugs and snails inside my Wellingtons. Actually, my boots were full of sand and water, but to my pre-school mind the gritty squelch was because of slimy gastropods, crawling into my shoes. My lesson: the water is indifferent to seams, borders and barriers. It invades us, as we invade it.

Aged about six, I stood at Noosa beach in subtropical Queensland, grinning as the warm sea frothed at my ankles. Then suddenly I was on my face, sand in my gap-toothed mouth, hacking up a lung while the waves pushed me over and over. Another lesson: the water is not kidding around.

Boats and submarines

At primary school, my father tried to teach me to "swim like a boat" at the local pools. I answered that I was a submarine, and stayed underwater, looking at the strange world of doubly rippled adult bodies: folds of fat and skin warped by waves from older kids jumping in the deep end. I loved the way the pool's chaos – kids’ screams, splashes, parental monologues about food and stitches – was muted by the water. Everything became a warm, fuzzy, blue-green noise.

I learned to be a boat, but the submariner remained. The water, for me, was always something to be in, not simply above. It was more a site of secular pilgrimage than a thoroughfare.

As a teenager, I spent weeks on end at the beach. I usually swam to the third reef of our local cove, marked by a high wooden pole stuck with mussels. To me, this marked the end of the beach and the start of the bay: the sand below dropped away. At this point, dry land was suddenly absurd – the whole world was waves, blurry blacknesses and solitude.

For hours, I floated and looked: at the unsettling, unnameable nothing of it all. Translucent, eerily quiet, a monolith of constant movement, the sea always suggested more than I saw. Treading water in fogged goggles, a tiny little hairless mammal without gills, dorsal fins or blowhole, I was scared and never happier.

What was I seeking in the pool and sea? I had no word for this waterlogged bliss. Perhaps English literature, which I studied absent-mindedly in year 11, might have suggested the word: swimming in the sea was sublime.

An agreeable kind of horror

The notion of the sublime was most popular in the 18th and 19th centuries. While the ideas varied, the sublime was summed up neatly by English author Joseph Addison, recently returned from his Grand Tour. "You have a near prospect of the Alps, which are broken into many steps and precipices," he wrote in Remarks on Several Parts of Italy, &c, "that they fill the mind with an agreeable kind of horror." In short: the sublime requires both enjoyment and fear.

Irish statesman and scholar Edmund Burke, writing half a century later, saw the ocean as an exemplary case of this sublime. The sea, argued Burke in A Philosophical Enquiry into the Origin of Our Ideas of the Sublime and the Beautiful, often inspires dread. Most obviously, the sea is immense. Even smaller bays swallow up the swimmer, suggesting a kind of infinity: a greatness that dwarfs the body and boggles the mind. Tom Farber, in On Water, calls it "that vastness where whales would be nothing in the vastness." The sea is often obscure, too: from a frothy bay thick with sand and kelp, to deep ocean reefs where light is dim, our eyes are hampered. The water’s silence achieves the same ambiguity: a muffled world we cannot quite fathom. "The old round of life and death," writes Jacques Cousteau, "passes silently." And not only the sea – David Allan Evans, in his short story The Celebration, described the "private, cold, and muddy darkness" of a rural lake. Even if the water is obviously safe, the murkiness works on the mind to imply dangerous or uncanny vastness. "A clear idea," wrote Burke, "is ... another name for a little idea." And little ideas do not frighten.

Burke also noted power’s role in the sublime: the sea’s energy is straightforwardly dangerous. We can drown in a cup of water, but the sea has strong waves and sharp rocks, which overpower strong swimmers and rip skin. "In rough ocean, I have thrown up from beginning to end of a 13-hour swim," wrote long-distance swimmer Diana Nyad, "swishing around like a cork ... I would do anything to stop this feeling – and the only thing that will is to be on dry land." The sea is also capricious in this, moving from mirror calm to violent storm in minutes. In short, we are never really in charge. "Wheresoever we find strength, and in what light soever we look upon power," wrote Burke, "we shall all along observe the sublime". The point is not that the sea actually does drown or cut us, but that we know it can, and that we are too weak to stop it. The sublime always requires some hint of danger and pain.

In fact, water in general can suggest danger and annihilation, because we are not well adapted to aquatic life. (Michael Phelps’s top sprinting speed is about a third of a dolphin’s.) Breathing is hampered as we swim. Studies suggest that the water compresses the chest, making it more difficult to inhale. While floating horizontally takes pressure off breathing muscles, blood pools in the lungs, leaving less room for oxygen. In freestyle, we also burn more energy for less oxygen, because of the short, over-the-shoulder breaths – what poet Maxine Kumin, in 400-Meter Freestyle, calls "little sips carefully expended". As a result, our lungs tire more quickly during swimming than during exercises like running or rowing – in a matter of minutes we suffer what researchers call "inspiratory fatigue". This, in turn, leaves us with less air in our lungs, and oxygen in our cells. This then has flow-on effects for the whole body: our muscles become weaker or slower, and have more trouble co-ordinating.

And when swimming, we are also using more muscle groups. Swimming is called "low impact" because it supports the body while it works – no thumping the asphalt with feet. But it is a particularly taxing exercise. Stomach, chest, upper and lower back, shoulders, biceps and triceps, and the upper and lower legs, including the feet: all working in a co-ordinated and continuous way to keep the swimmer from stopping and sinking.

Put simply, even the local pool can suggest danger, by highlighting the continual effort required to simply keep our head above water. Swimming, whether in salt water or chlorine, evokes the sublime by revealing just how vulnerable we are.

The water can also encourage the secretion of norepinephrine, which ups heart rate, triggers glucose release and gets our muscles ready to respond. This is not only useful for survival, but also stimulating. This is evoked by Jack London’s breathless prose in his story The Kanaka Surf, as he describes a couple body-surfing: "side by side, and six feet apart ... they dived straight under the over-curl even then disintegrating to chaos and falling." Tim Winton describes this same battered exhilaration in young West Australian surfers. "The back was out of his wetsuit and there was skin off his shoulders," Winton writes in Breath. "His nose bled, his legs trembled, but by the time Sando reached us he was laughing."

So swimming, because of water’s unique properties, suggests stimulating potency. This is different to climbing and gymnastics, in which pain or danger direct our awareness. These feelings allow "flow" to arise, by fixing attention on what’s vital for success or survival. With the sublime, feelings of discomfort and threat are the feeling – they are enjoyed as part of the encounter with power. The water’s fluidity, size, and power encourage a vulnerable aliveness.

Does this mean we have to drive to the roughest, most treacherous beaches to savour the sublime? No, Burke argued: there is no enjoyment of the sublime without safety. Being picked up by a wave and dumped on sharp mussel shells is not blissful – it simply hurts. Swimming too far and becoming lost provides no joy – it is just terrifying. The sublime comes from the passions of survival, without the desperate need to survive. "When danger or pain press too nearly, they are incapable of giving any delight, and are simply terrible," wrote Burke, "but at certain distances, and with certain modifications, they may be ... delightful." In other words, the sublime sea is best enjoyed by a strong swimmer in the surf, or a weak swimmer in the shallows or pool.

The sublime slow lane. Photograph: Damon Young Photograph: Damon Young

That ‘oceanic’ feeling

The German philosopher Arthur Schopenhauer, writing in The World as Will and Idea, added to this portrait of the swimming sublime: it involves a feeling of oneness. Schopenhauer described a storm at sea, with "waves, high as houses ... driven violently against steep cliffs." Anyone watching this is profoundly aware that they are, as Schopenhauer put it, "an infinitesimal dot in relation to stupendous powers". This is not a feeling reserved for 19th-century scholars. "I seemed to shrink and shrink," wrote Australian swimmer Annette Kellerman, "till I was nothing but a flecky bubble and feared that the bubble would burst."

Yet at the same moment the beachgoer feels tiny and powerless, argued Schopenhauer, they also feel "eternal, tranquil". To illustrate this, Schopenhauer introduced the idea of the night sky, with its "countless worlds". His idea was that, in reflecting on the infinity of blackness and stars, we recognize that all the universe’s details are our own invention – the categories of selfish minds trying to survive. The real cosmos is a great whole and we are parts of it; we are, as Schopenhauer put it, "exalted by its immensity".

We do not have to commit to the German’s philosophy to explain his "exultation". The oneness of the snorkeller does not simply arise from reflection; from some otherworldly meditation. We are literally in the sea or pool. Our skin, even in a wetsuit, is constantly in contact with the water. Of course this is true of the air too – only astronauts escape into a vacuum. But we do not normally feel the air. Whereas the water clings to us; every part of our skin registers this thin presence: cool, flowing, heavy. "I love to throw myself into the sea," wrote Sharon Olds in her poem The Swimmer, "cold fresh enormous palm around my scalp."

Importantly, this grip does not stop us paddling, kicking, diving – the water is somewhat hospitable, displaced by our mass. It is, in other words, enveloping but accommodating. Again, the air also does this, but the water helps us feel it. Poet Charles Tomlinson evokes the feeling of fluid parting and closing, in Swimming Chenango Lake. The water, torn by his moving body, "flows-to behind him", healing as it does.

This has led many to treat the water as a god or womb – something grand and exulted that one returns to. Novelist John Updike plays with this idea: in Lifeguard, one of his short story’s characters is a young divinity student and lifeguard, who sees himself as a priest, overseeing the bathers worshipping in the waters. "We enter the sea with a shock; our skin and blood shout in protest. But in that instant that leap, past, what do we find? Ecstasy and buoyance." The sea is a savage, wrathful god, which will absorb us (whether we like it or not).

In The Swimmer, Mary Oliver swaps Updike’s New Testament ocean for a more pagan, maternal sea, in which "every wall was water". Naturalist Ann Zwinger, in A Desert Country Near the Sea, describes this life under "the silken tent" of the waves: "how simple it is for those who pivot or rasp, supported and fed, adrift in an infinite womb ... suspended easily in this friendly bath without having to battle the incessant pull of gravity." This is the sea as a fluid space we are vitally part of, which literally takes the weight off our feet. "Reaching the water again, one smiles," writes Tom Farber in On Water. ‘To come back down to the ocean is to re-experience an essential memory trace, something one has known well, to recall that one has been trying to remember."

Like Schopenhauer, the French author Romain Rolland was a devotee of Indian spirituality. Writing to Sigmund Freud, Rolland used a telling phrase to describe this oneness of ancient religions: "oceanic".

Falling into the world

What is the sublime telling us? For all this metaphysical talk, the sublime is not a secret universe, invisible to the ordinary eye. Instead, the sublime is a revelation of ordinary human contradiction: the reality of our solitude and smallness, together with the intimation of safety and immensity. We are isolated and feeble, yet somehow joined with a world of security and strength.

Taken off the land and dumped into a few feet of water, Homo sapiens is a clumsy species. Even if we are confident swimmers, the water’s enveloping power and caprice are intimidating. Particularly in the ocean – but pools too can challenge gifted swimmers – we confront the borders of our territory.

This is a recognition of what philosophers call "finitude": the basic fact of limitation. To exist at all is to be a definite this, and not something else. However free we are, we cannot escape basic biology – these limbs, lungs and blood, this universe of force and gravity. More importantly, we cannot escape our mortality: pain and death will come to all of us, and no one can die on our behalf. Finitude is the recognition that we are fundamentally limited in time and space: small, easily broken things, whose clocks are always ticking.

This is why the sublime includes emotions like fear, shock, awe – they warn us that our puny bodies are in danger.

And yet the sublime also includes joy. Why? Partly because we are safe. Even if we are frightened, this is not abject terror – it becomes a buzz, instead of a warning horror. Meanwhile, gravity is put on hold. We are literally buoyed, and physically united with worldly stuff. We are part of the cosmos and its necessities. This need not suggest the divinity or womblike return noted by philosophers, novelists and poets – Rolland’s "oceanic feeling". Instead, it is the recognition that, for all our weakness and isolation, we are strong, secure, and part of something bigger than our feeble selves.

Sigmund Freud, in Civilization and its Discontents, tried to capture Rolland’s "oceanic feeling" with a line from Hannibal, by the German dramatist Christian Dietrich Grabbe: "we cannot fall out of the world". This is the philosophical message of the sublime: for all our frailty, we are in this world, right now. It might be dangerous or baffling, but the world can be savoured. We can feel its immensity and potency.

In other words, the sublime is an introduction to the halfway house of human existence. It highlights our unique relation to the world: distant enough to see it from afar as something "other", close enough to be moved and shaken. By threatening us, it stimulates. And, by keeping us secure, it allows us to enjoy this stimulation.

Swimming, in this, is a chance to savour the precariousness of life – before we fall out of the world for good.

This is an edited extract from Damon Young’s How to Think About Exercise (Pan Macmillan), available now.