There are urban myths that mammals like camels and pigs lack the ability to swim – but as far as we know just one genus of mammals struggles to keep its head above water

My girlfriend's grandparents, Audrey and Hamish, are an inquisitive pair with a keen interest in all things biological. One day, they decided to test a pet theory of Audrey's.

"I've always thought that all mammals can produce milk and that they can swim," she says, "although not at the same time."

And so, it came to pass that they found themselves gathered with their daughters around the garden pond clutching their pet guinea pigs. "We had a fishing net in case anybody got in trouble, we put the guinea pig in one side, and it doggy-paddled – or guinea pig paddled – over to the other."

"That's the only experimental experience we have," says Hamish, explaining his view that because most mammals walk on four legs, they should be able to swim instinctively using a "doggy-paddle" style.

But is he right?

Some mammals are clearly natural swimmers. Whales, seals and otters have evolved to move effortlessly through the water. Many terrestrial mammals are capable swimmers too; dogs of course, but also other domestic animals such as sheep and cows. Even cats can swim well, although they don't enjoy it much.

It has even been suggested that the elephant's trunk originally evolved as a snorkel

Other species have reputations as non-swimmers – camels, for example. Ships of the desert they may be, but why would they possess the ability to swim when they seldom set foot near water? In fact, consultation with camel veterinarians and ranchers reveals that the humped quadrupeds have an unlikely willingness to enter water when they encounter it, particularly a breed known as Kharai – the "swimming camels" of Gujarat.

Pigs, meanwhile, have been subject of a legend claiming they cannot swim without cutting their own throats with their sharp trotters, as described in a poem by Samuel Taylor Coleridge:

Down the river did glide, with wind and with tide
A pig with vast celerity
And the Devil looked wise as he saw how the while
It cut its own throat

This is simply untrue, as the Bahamas Ministry of Tourism will gladly inform you. There, a colony of seafaring swine living on Big Major Cay has become a famous attraction, earning the islands the self-proclaimed title "Official Home of the Swimming Pigs".

If a desert-dwelling lifestyle isn't a setback, then what about weight?

It was once assumed by scientists that elephants, the heaviest living land animals, were incapable of swimming. This assumption meant that biogeographers had to think up complicated explanations for the presence of fossil elephants on islands off the coasts of California, China and the Mediterranean.

In fact, it turns out elephants are accomplished swimmers, capable of covering distances approaching 50km. It has even been suggested that the elephant's trunk originally evolved as a snorkel.

There was a time when it wasn't unusual to test an animal's swimming ability by just dropping it into some water

Even the armadillo, far from being encumbered by its awkward shell, can counterbalance the weight by gulping down air to inflate its stomach and intestines when paddling across water.

This is good for starters, but there are 5,416 known species of mammal in the world. Confirming all of them can swim would involve dunking a lot of unwilling creatures in ponds.

"I have to say those experiments were done," says Frank Fish, an expert in aquatic locomotion at West Chester University, Pennsylvania. No one has got round to assessing every mammal, but there was a time when it wasn't unusual to test an animal's swimming ability by just dropping it into some water.

A 1973 research paper by Anne Dagg and Doug Windsor involved placing 27 terrestrial species, ranging from shrews to skunks, into a three-metre-long tank of water to see how they fared. Fortunately, they were all able to swim – even the bat, which moved "using a cumbersome stroke with its wings that resembled the human 'butterfly breaststroke'."

Sadly, researchers weren't always satisfied with finding out whether the animals could swim or not. Dagg and Windsor's paper references a series of "inhumane experiments in which a variety of species were swum until they were exhausted or died" conducted throughout the late 50s and 60s.

Thankfully, it's unlikely such experiments would take place today. "Ethics change, what was acceptable back then is not acceptable now," confirms Fish.

Even the bat swims using a cumbersome stroke that resembled the human butterfly breaststroke

That aside, such studies appear to vindicate Audrey's theory, particularly if animals so superbly unaccustomed to aquatic life as bats fare well in water.

So why should swimming be such a generalised behaviour in mammals, even those that have no need to swim? Fish reckons it's a side-effect of mammalian anatomy. "Mammals have decent-sized lungs, which are going to give them quite a bit of buoyancy," he explains. "Fur is important too, but it becomes less important as the mammals get larger." This, together with the fat mammals accumulate under their skin, makes them suitably buoyant.

"Given all that, mammals will tend to float," says Fish, "and if you can float, then you can swim."

So are we to assume that every mammal can swim? One treatise from 1963 on the delightfully esoteric topic of 'the swimming capacity of the golden hamster', states "it is well known that most wild mammals can swim"; most, but not all. From the literature, a consensus emerges that there are two groups of mammalian non-swimmers: giraffes and great apes.

Giraffes definitely don't look like natural swimmers. With such extreme anatomy, it seems plausible that they really are unable to float in water. No one has ever been foolhardy enough to build a giraffe-sized water tank, but thanks to a couple of inquisitive palaeontologists they might not have to.

Intrigued by numerous mentions in the literature, science writer and palaeontologist Darren Naish decided to test the hypothesis that giraffes can't swim. "I'm extremely sceptical of such claims, given that other animals sometimes said to be unable to swim – like giant tortoises, pigs, rhinos and camels – actually swim just fine or even very well," he wrote in his Tetrapod Zoology blog.

Mammals will tend to float, and if you can float, then you can swim

To devise an experiment that was both ethical and dry, Naish approached Donald Henderson of the Royal Tyrrell Museum of Palaeontology in Drumheller, Alberta, Canada. Henderson specialises in creating computer models of animals both extinct and extant. "I originally started making these models for locomotion and estimating body weight, but then I realised I could also look at flotation," he explains. As luck would have it, Henderson actually had a giraffe model pre-prepared, so the pair decided to finally put the matter to bed by finding out whether or not it would float.

"We found that the giraffe could float and its head was close to the surface, but it would have a bit of a struggle to keep its nostrils clear," says Henderson, explaining that drag on the creature's long limbs would also make it pretty ungainly in the water. "It's not impossible that a giraffe could swim, but it would be strenuous, and I could see why they would be reluctant to do it," he concludes. "That may give rise to this observation that giraffes don't swim."

Apes have had their swimming abilities tested in a far less humane fashion. Ethologist Robert Yerkes recounts a story from the turn of the 20th Century in which William Hornaday, founder of the Bronx Zoo, took a tame orang-utan to a creek to bathe:

"Poising him on the surface [I] let him go, much against his will. Did he swim? Hardly. He turned heels up in an instant and his old head went down as if it had been filled with lead instead of brains."

It's not impossible that a giraffe could swim, but it would be strenuous

This cruel experiment is sadly not exceptional. Yerkes himself describes throwing young chimpanzees into water to see if they sink or swim. "Without exception they struggled excitedly and quickly sank," he writes. For this reason, moats are often used in zoos to prevent apes from escaping.

Hornaday describes how "instead of striking out vigorously with his arms and legs as other animals do, those useful members simply stuck straight out from his body like four sticks and moved slowly and feebly". Clearly, something about great apes makes them unable to swim in a coordinated fashion.

"People will tell you chimpanzees are not able to swim because they don't float," says Renato Bender, a research fellow at the University of the Witwatersrand's Institute for Human Evolution in South Africa. "It's not about floating; it's about having the right swimming pattern."

His point is that most mammals swim instinctively because they employ the same gait they use on land – just as my girlfriend's grandfather Hamish had suspected. "If you're a quadruped, what you're basically doing when you swim is using a motor pattern that is set up already, and just applying that to water," says Fish. This is why swimming quadrupeds tend to use a "doggy paddle" style.

Noting that kangaroos can escape into water when chased by predators, George Wilson of the Australian National University in Canberra found that when red kangaroos with no prior swimming experience entered a pool, even they began to swim doggy-paddle – quite different from their usual hopping gait.

A dolphin is basically galloping underwater, but without legs

He concluded that this may "represent a reversion to earlier times" in their evolutionary history. Even in the most superbly-adapted aquatic creatures, the pattern is roughly the same. "A dolphin is basically galloping underwater, but without legs," says Fish.

But apes are also quadrupeds, so why would this logic not apply to them?

Back in 2013 Bender, together with his wife Nicole – a medical researcher at the University of Bern, Switzerland – challenged received wisdom by filming a chimpanzee called Cooper and an orangutan called Suryia happily making their way across swimming pools. These were the first video observations of great apes swimming.

Counterintuitively, the researchers think this behaviour explains exactly why apes lack the innate ability to swim.

These apes were not born with their abilities; they had to learn. A former swimming teacher himself, Bender noted a key difference in the way they moved: less doggy paddle, more breaststroke.

This change in style, he thinks, is no accident, but instead hints at deep evolutionary history. As the ancestors of these apes adapted to life in trees, not only did they lose the need to enter water, but their neuromotor systems and anatomy modified to make them more suited to swinging through trees.

The ancestral ape lost not just the desire but the ability to perform the doggy paddle

These changes resulted in an ancestral ape that lost not just the desire but the ability to perform the doggy paddle, something the Benders have termed the "Saci last common ancestor hypothesis" after a one-legged character from Brazilian folklore who cannot cross bodies of water. On the rare occasions when apes do learn to swim, the increased mobility in their limbs resulting from an arboreal lifestyle makes the "frog-kick" of breaststroke a more natural movement.

The implication here is that swimming is not solely a happy side effect of buoyancy and four limbs, but that natural selection has actively maintained the ability to swim in all other mammals. Fish, however, thinks this may be a stretch: "Mammals lost their aquatic ability back in the Devonian, when fishes started coming out of the water," he explains. "That's a long time to hold onto the chance that you are going to go back."

Nevertheless, Audrey's hypothesis was not far off. Swimming appears to play a surprising role in the ecology of some rather unexpected mammals, whether that's the dispersal of prehistoric elephants or the evasion of predators by kangaroos. Perhaps it is a more important behaviour than has previously been acknowledged.

Then there is the mammal for which swimming has transcended ecology altogether; that other great non-swimming ape: the human.

There is a widespread belief, perhaps stemming from that Nirvana album cover, that babies possess an innate swimming ability. This is false. While babies do indeed hold their breath when submerged in water, this should not be mistaken for swimming. Breath-holding is part of the mammalian diving reflex – a suite of physiological changes resulting from immersion in water that is present in all mammals, but strongest in marine species. Like Cooper and Suryia, our ape cousins, humans must learn to swim.

But being the clever primates we are, we've learnt to do it pretty well. The world's best free divers and Olympian swimmers can achieve feats that are unimaginable for any other terrestrial mammal, and humans all over the world learn to swim for work, play and cultural reasons.

Like our ape cousins, humans must learn to swim

Our affinity with water when compared with other apes is one of the traits that encouraged the formation of the so-called aquatic ape hypothesis. This idea holds that many of our defining characteristics (hairlessness, bipedalism, large brains etc.) resulted from a period of our evolutionary history spent living a semi-aquatic lifestyle.

The aquatic ape hypothesis lacks scientific support, but it has acquired a lot of adherents nevertheless. Bender feels its popularity has stifled serious research into primates' interactions with water, and the effects it could have had on our behaviour and evolution.

"[I want to] make people understand that you should separate 'water in human evolution' and the aquatic hypothesis, and then begin to research it scientifically," he says. "There is lots of evidence of chimpanzees and orangutans playing with water for hours and hours. Water is very interesting; intelligent animals find it fascinating, and we are intelligent animals."

Join over six million BBC Earth fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital and Travel, delivered to your inbox every Friday.