Taking a stroll with Shane O’Mara is a risky endeavour. The neuroscientist is so passionate about walking, and our collective right to go for walks, that he is determined not to let the slightest unfortunate aspect of urban design break his stride. So much so, that he has a habit of darting across busy roads as the lights change. “One of life’s great horrors as you’re walking is waiting for permission to cross the street,” he tells me, when we are forced to stop for traffic – a rude interruption when, as he says, “the experience of synchrony when walking together is one of life’s great pleasures”. He knows this not only through personal experience, but from cold, hard data – walking makes us healthier, happier and brainier.

We are wandering the streets of Dublin discussing O’Mara’s new book, In Praise of Walking, a backstage tour of what happens in our brains while we perambulate. Our jaunt begins at the grand old gates of his workplace, Trinity College, and takes in the Irish famine memorial at St Stephen’s Green, the Georgian mile, the birthplace of Francis Bacon, the site of Facebook’s new European mega-HQ and the salubrious seaside dwellings of Sandymount.

O’Mara, 53, is in his element striding through urban landscapes – from epic hikes across London’s sprawl to more sedate ambles in Oxford, where he received his DPhil – and waxing lyrical about science, nature, architecture and literature. He favours what he calls a “motor-centric” view of the brain – that it evolved to support movement and, therefore, if we stop moving about, it won’t work as well.

This is neatly illustrated by the life cycle of the humble sea squirt which, in its adult form, is a marine invertebrate found clinging to rocks or boat hulls. It has no brain because it has eaten it. During its larval stage, it had a backbone, a single eye and a basic brain to enable it to swim about hunting like “a small, water-dwelling, vertebrate cyclops”, as O’Mara puts it. The larval sea squirt knew when it was hungry and how to move about, and it could tell up from down. But, when it fused on to a rock to start its new vegetative existence, it consumed its redundant eye, brain and spinal cord. Certain species of jellyfish, conversely, start out as brainless polyps on rocks, only developing complicated nerves that might be considered semi-brains as they become swimmers.

Seán O’Casey Bridge in Dublin. Photograph: Johnny Savage/The Guardian

Sitting at a desk all day, it’s easy to start feeling like a brainless polyp, whereas walking and talking, as we are this morning, while admiring the Great Sugar Loaf mountain rising beyond the city and a Huguenot cemetery formed in 1693, our minds are fizzing. “Our sensory systems work at their best when they’re moving about the world,” says O’Mara. He cites a 2018 study that tracked participants’ activity levels and personality traits over 20 years, and found that those who moved the least showed malign personality changes, scoring lower in the positive traits: openness, extraversion and agreeableness. There is substantial data showing that walkers have lower rates of depression, too. And we know, says O’Mara, “from the scientific literature, that getting people to engage in physical activity before they engage in a creative act is very powerful. My notion – and we need to test this – is that the activation that occurs across the whole of the brain during problem-solving becomes much greater almost as an accident of walking demanding lots of neural resources.”

O’Mara’s enthusiasm for walking ties in with both of his main interests as a professor of experimental brain research: stress, depression and anxiety; and learning, memory and cognition. “It turns out that the brain systems that support learning, memory and cognition are the same ones that are very badly affected by stress and depression,” he says. “And by a quirk of evolution, these brain systems also support functions such as cognitive mapping,” by which he means our internal GPS system. But these aren’t the only overlaps between movement and mental and cognitive health that neuroscience has identified.

I witnessed the brain-healing effects of walking when my partner was recovering from an acute brain injury. His mind was often unsettled, but during our evening strolls through east London, things started to make more sense and conversation flowed easily. O’Mara nods knowingly. “You’re walking rhythmically together,” he says, “and there are all sorts of rhythms happening in the brain as a result of engaging in that kind of activity, and they’re absent when you’re sitting. One of the great overlooked superpowers we have is that, when we get up and walk, our senses are sharpened. Rhythms that would previously be quiet suddenly come to life, and the way our brain interacts with our body changes.”

From the scant data available on walking and brain injury, says O’Mara, “it is reasonable to surmise that supervised walking may help with acquired brain injury, depending on the nature, type and extent of injury – perhaps by promoting blood flow, and perhaps also through the effect of entraining various electrical rhythms in the brain. And perhaps by engaging in systematic dual tasking, such as talking and walking.”

One such rhythm, he says, is that of theta brainwaves. Theta is a pulse or frequency (seven to eight hertz, to be precise) which, says O’Mara, “you can detect all over the brain during the course of movement, and it has all sorts of wonderful effects in terms of assisting learning and memory, and those kinds of things”. Theta cranks up when we move around because it is needed for spatial learning, and O’Mara suspects that walking is the best movement for such learning. “The timescales that walking affords us are the ones we evolved with,” he writes, “and in which information pickup from the environment most easily occurs.”

Essential brain-nourishing molecules are produced by aerobically demanding activity, too. You’ll get raised levels of brain-derived neurotrophic factor (BDNF) which, writes O’Mara, “could be thought of as a kind of a molecular fertiliser produced within the brain because it supports structural remodelling and growth of synapses after learning … BDNF increases resilience to ageing, and damage caused by trauma or infection.” Then there’s vascular endothelial growth factor (VEGF), which helps to grow the network of blood vessels carrying oxygen and nutrients to brain cells.

Robots can’t do this. Getting a robot to cross the road is really hard Shane O'Mara

Some people, I point out, don’t think walking counts as proper exercise. “This is a terrible mistake,” he says. “What we need to be is much more generally active over the course of the day than we are.” And often, an hour at the gym doesn’t cut it. “What you see if you get people to wear activity monitors is that because they engage in an hour of really intense activity, they engage in much less activity afterwards.”

But you don’t get the endorphin high from walking, I say. “The same hit you get from running is what you’d get from taking morphine? We simply don’t know that’s true,” he says. “People who study this area don’t go on about endorphins and there may be a reason for that.” Not that he is opposed to vigorous exercise, but walking is much more accessible and easily woven into everyday life: “You don’t need to bring anything other than comfy shoes and a rain jacket. You don’t have to engage in lots of preparation; stretching, warm-up, warm-down …” O’Mara gets off his commuter train a stop early so that he can clock up more steps on his pedometer. To get the maximum health benefits, he recommends that “speed should be consistently high over a reasonable distance – say consistently over 5km/h, sustained for at least 30 minutes, at least four or five times a week.”

Twice during our circuitous route, he asks me to point to where I think our starting point of Trinity College is, and my estimates are pretty close. “That just shows you how good your GPS is,” he says. “You have never been here before, but you have a very good sense of where you need to go.” This is reassuring, I say, because, of course, Google Maps is enfeebling our innate abilities to find our way. “That’s absolute garbage,” says O’Mara. “We really have to get a grip. If you hire a car and drive around a country you’ve never been in, taking a route into a city you’ve never driven into before, the first time, you rely very heavily on the GPS. The second time, not quite so much and, by the third or fourth time, you don’t need the GPS at all, because you’ve learned the route. I actually think GPS is great for helping us disambiguate where we are.”

So it’s mere speculation that relying on satnavs is killing our sense of direction? “Yeah it is. There is no data of any quality showing that, over the long term, reliance on GPS is a bad thing. Honestly, the brain is much more robust.”

O’Mara describes our inbuilt GPS, or cognitive mapping system, as a silent sense. “It is constructed largely without our awareness, and we only notice it if it fails us.” While the sensitive vestibular system of the inner ear governs balance, for mental mapping (which can work even when our eyes don’t), we have what are known as place cells in our hippocampi. If you stay in one place, the cell for that position keeps firing, but if you move, that cell will stop firing and a cell marking your new position will start firing and so on. In rat experiments, the system worked less well when the rodents were wheeled around as opposed to walking.

It’s clever, but not infallible. “We get fooled when we walk a long way in a single direction,” says O’Mara. We need to keep looking around us and recalibrating with visual cues. “If you’re feeding your place cells by coming from a single direction, what they know about the environment is that single direction and you want them to have input from all directions, so look around occasionally and your place cells will reset from the whole sensorium around you.”

While all this is going on in the background, our social brains are working to predict which direction others will take, to avoid collision. In order to walk and navigate, the brain flickers between regions, just as our waking minds are often, says O’Mara, “flickering between big-picture states – thinking about what we have to do tomorrow, plans for next year, engaging in what is called ‘mental time travel’ – and task-focused work. And you need to flicker between these states in order to do creative work.” That’s how important associations get made, and this flickering seems to be bolstered by walking.

It’s part of the reason, O’Mara suspects, that the prolific writer and thinker Bertrand Russell said that walking was integral to his work. Likewise, the Irish mathematician William Rowan Hamilton, who pondered a single problem on his daily walks for seven years, eventually inventing a number system called quaternions, without which we couldn’t make electric toothbrushes or mobile phones.

O’Mara’s ultimate ode to urban walking is TS Eliot’s 1915 poem The Love Song of J Alfred Prufrock, which he describes as “a journey on foot, and a journey through states of mind”. Wordsworth composed poetry as he wandered, while Aristotle delivered lectures on foot in the grounds of his school in Athens. The philosopher Friedrich Nietzsche memorably said that “only thoughts reached by walking have value”, a notion that Charles Dickens – who was as prolific a walker as he was a writer – would no doubt have seconded.

And, while my mind has been flickering through the streets of Dublin, says O’Mara, “you haven’t died or fallen over, and you’re continuing to breathe. Your heart is booming away. You’re putting one foot in front of the other, and we’re engaging in this conversation, information exchange.” Plus, I’m checking out the area, admiring fanlights and looking for clues of neighbourhood life. “All of this is going on all the time. Robots can’t do this. Getting a robot to cross the road is really hard.” Whereas for our brains, “evolution has been solving this problem, billions of times an hour, for the past 400m years”.

In Praise of Walking by Shane O’Mara is published by Vintage (£16.99). To order a copy for £14.95 go to guardianbookshop.com or call 0330 333 6846