In July 2008, I rented a small yellow car in Tucson, Arizona, and drove it south towards Tombstone. My passengers included an entomologist and two microbial geneticists, and I was following a white van with government plates carrying nine more geneticists. We also had 500 plastic bags, a vacuum flask of dry ice, and 350 cryogenic vials, each the size and shape of a pencil stub. We had two days to get 10,000 termites.

The goal was to sequence the genes of the microbes in their guts. Because termites are famously good at eating wood, those genes were attractive to government labs trying to turn wood and grass into biofuels (“grassoline”). The white van and the geneticists all belonged to the US Department of Energy’s Joint Genome Institute. Perhaps by seeing exactly how termites break down wood, we’d be able to do it too.

We stopped in the Coronado national forest, near the border with Mexico. I lifted a rock and saw a glint of glossy exoskeleton flowing into some little tunnels. I dropped to my knees and began sucking on an aspirator, a disgusting process that stimulated saliva production and made me dizzy. Two minutes later, there were no more termites on the ground and I had about 25 in the test tube attached to the aspirator.

But my pale termites were disappointing. When I separated one from the clutch, it was less substantial than a baby’s fingernail clipping. Doddering around blindly, it waved the flimsy antennae on its bulbous head. In its stubby, translucent body I could almost see its coiled guts – and presumably whatever it had eaten for lunch. Ants have snazzy bodies with three sections, highlighted by narrow waists, like a pinup model’s, between the segments. Termites, which are no relation to ants or bees, have round, eyeless heads, thick necks and teardrop-shaped bodies. And they long ago lost cockroaches’ repulsive dignity, gnarly size and gleaming chitinous armour. I put the termite back in the test tube.

What had I just sucked up? My little gang of 25 was incapable of doing much of anything. Without a colony, they had nowhere to bring food to, and thus no reason to forage. Without a crowd of soldiers, they couldn’t defend themselves. Without a queen, they couldn’t reproduce. Twenty-five termites are insignificant in the scheme of life and death and reproduction. Meaningless. What’s more, they were clinging to one another, making an icky beige rope of termite heads, bodies and legs reminiscent of the game Barrel of Monkeys. In the miniature scrum I couldn’t even see a single termite – they looked like a clot, not a group of individuals. Or perhaps I had found a single individual who happened to have 25 selves.

I had stumbled into one of the big questions termites pose, which is, roughly, what is “one” termite? Is it one individual termite? Is it one termite with its symbiotic gut microbes, an entity that can eat wood but cannot reproduce on its own? Or is it a colony, a whole living, breathing structure, occupied by a few million related individuals and a gazillion symbionts who collectively constitute “one”?

The issue of one is profound in every direction, with evolutionary, ecological and existential implications. By the end of that day I had a basic idea that the fewer I saw, the more termites there might be. Where I had thought of landscapes as the product of growth, on that afternoon they inverted to become the opposite: the remainders left behind by the forces of persistent and massive chewing. The sky was no longer the sky, but the blue stuff that is visible after the screening brush and cacti have been eaten away. Termites have made the world by unmaking parts of it. They are the architects of negative space. The engineers of not.

Nobody loves termites, even though other social insects such as ants and bees are admired for their organisation, thrift and industry. Parents dress their children in bee costumes. Ants star in movies and video games. But termites are never more than crude cartoons on the side of exterminators’ vans. Termite studies are likewise a backwater, funded mostly by government agencies and companies with names such as Terminix. Between 2000 and 2013, 6,373 papers about termites were published; 49% were about how to kill them.

Every story about termites mentions that they consume somewhere between $1.5bn (£1.1bn) and $20bn in US property every year. Termites’ offence is often described as the eating of “private” property, which makes them sound like anticapitalist anarchists. While termites are truly subversive, it’s fair to point out that they will eat anything pulpy. They find money itself to be very tasty. In 2011 they broke into an Indian bank and ate 10m rupees (then £137,000) in banknotes. In 2013 they ate 400,000 yuan (then £45,000) that a woman in Guangdong had wrapped in plastic and hidden in a wooden drawer.

Facebook Twitter Pinterest Harvester termite workers. Photograph: Alamy Stock Photo

Another statistic seems relevant: termites outweigh us 10 to one. For every 60kg human you, according to the termite expert David Bignell, there are 600kg of them. We may live in our own self-titled epoch – the Anthropocene – but termites run the dirt. They are our underappreciated underlords, key players in a vast planetary conspiracy of disassembly and decay. If termites, ants and bees were to go on strike, the tropics’ pyramid of interdependence would collapse into infertility, the world’s most important rivers would silt up and the oceans would become toxic. Game over.

By the end of our termite-collecting trip we had 8,000 termites in plastic tubs and bags, but they needed to be labelled and stored in dry ice before going to California to be sequenced. Once frozen in the vacuum flask, the termites were on their way to immortality: a collection of genetic code sitting in some database on a server somewhere, intellectual property, a sequence of nucleotides that might solve a wicked problem some day.

We were on the border between natural history and an unnatural future. We weren’t alone: all over the world, scientists are trying to find biology’s underlying rules and put them to use. They’re doing it with genes, behaviours, metabolisms and ecosystems. They’re seeing nature in new ways, and at the same time they’re trying to reinvent it and put it to work for us. In the future, we will harness nature’s tiniest life forms – microbes and insects – both their systems of organisation and control, and their genes and chemical capabilities. This fits with our paradoxical desire to have a lighter footprint on the Earth while having greater control over its processes.

At the core of this project is the provocative dream of changing biology into a predictive science, much the way physics started as the observation of phenomena such as gravity and then became the science of making plans for the atom bomb. Will there be termite bombs?

Termites, I came to understand, are the poster bug for the 21st century – a little guide to really big ideas.

Termite colonies begin theatrically on rainy evenings. Small holes open in the sides of existing termite homes and largish, winged termites emerge, shake out their sticky wings, and fly. In northern California, termites of the genus Reticulitermes suddenly appear on the sides of buildings they inhabit. In South America, Nasutitermes shower down from nests in the trees. In New Orleans, Formosan termites, of the genus Coptotermes, burp from colonies in the ground and take to the air in swarms so dense they show up on weather radar. In Namibia, giant Macrotermes mounds seem to spring a leak, spilling froths of winged termites down their sides.

In the mound, most of the termites are eyeless and wingless, but the fertile termites who leave the mound on this night have eyes and what at first appears to be one single translucent teardrop-shaped wing. When they are ready to fly, this single wing, still soft and moist, fans out into four. Called “alates”, these termites are like fragile balsa-wood glider planes: just sturdy enough to cruise briefly before crash-landing their payloads of genes.

Male and female find each other and scuttle off to dig a burrow where they will mate. At first the two termites will be alone in their dark hole. Christine Nalepa, Theo Evans and Michael Lenz have written that termite parents bite off the ends of their antennae, which may make them better at raising their young. Antennae give termites lots of sensory information, and biting off the segments toward the ends could reduce that stimulation, making it easier to live in a tiny burrow with a few million children.

After she has laid her first eggs, the queen cleans them often to remove harmful fungi until they hatch as nymphs about three weeks later. The nymphs will moult grow and develop, but under the influence of the queen’s pheromone, most of them won’t fully mature, remaining permanent stay-at-home preteens – eyeless, wingless helpers.

Males and females alike will spend their time gathering food, tending eggs, building the nest deeper into the ground and eventually tending a fungus. As the family grows bigger, some morph into soldiers; their heads grow larger, dark-coloured and hard in a distinctive way, depending on their species. Thereafter they must be fed by their siblings the workers. Soldiers appear to return the favour by dosing the colony with antimicrobial secretions that help it resist disease.

Over time, in the small smooth dirt room where she lives, the queen’s body becomes “physogastric”, her abdomen swelling to the size of my thumb, constricted by taut black bands remaining from her old exoskeleton so she looks like a soft sausage that has been carelessly bound with string. Her head, thorax and legs remain tiny. Immobilised, except for the ability to wave her legs and bobble her head, she lays eggs at the rate of one every three or so seconds. The king stays by her. Her children lick off the liquid that appears on her skin, feed her and care for the eggs.

Or at least, that’s life for some Macrotermes queens (the genus found in Africa and south-east Asia, that builds its mound around a massive fungus). There are, however, at least 3,000 named termite species, and thus at least 3,000 ways to be termites. Some have multiple queens; some have cloned kings or queens; some are, improbably, founded by two male termites. One species doesn’t really have workers. Different species eat wood, others eat grass and some eat dirt. Macrotermes tend a fungus, but most others do not. All termites, though, live in their own version of a big commune.

Facebook Twitter Pinterest Zebras by a termite mound in Okonjima, Namibia. Photograph: Alamy Stock Photo

The South African writer Eugène Marais spent many years peering into their mounds and wrote The Soul of the White Ant, originally published in English in 1937. Marais called the termite mound a “composite animal”, uniting the millions of sterile workers, the soldiers, the fat queen and the king with the dirt structure of the mound itself into a single body. “You will need to learn a new alphabet,” he warned his readers before leading them in. The hard-packed dirt on the outside of the mound, he said, is a skin constructed by termites, which build passageways inside that allow the mound to breathe – like a lung. The organism’s stomach is the symbiotic fungus that sits in catacombs under the mound, digesting grasses delivered by termites. The mound’s “mouth” can be found in the hundreds of foraging tunnels the termites construct through the surrounding landscape. Because they carry nutrients and rebuild the mound, the sterile workers resemble blood cells. The mound’s “immune system” is the soldiers, who rush to defend the space whenever it is invaded.

To Marais, the queen was no Victoria, but instead a captive ovary, walled into a chamber no bigger than her swollen, sweating body. Marais imagined that eventually the mound would evolve into a being that could move across the veldt – very slowly in its dirt skin – a monster hybrid of soil and soul. Marais’s insight wasn’t original, and many scientists had taken to calling such social arrangements of termites, bees and ants “superorganisms”. The originator of the term was the entomologist William Wheeler, the founder of the study of ants in the US, author of a 1911 article called The Ant-Colony as an Organism.

For a time, superorganisms were all the rage. The concept dealt neatly with what Charles Darwin had called the “problem” with social insects. Darwin’s theory of evolution proposed that natural selection worked on individuals and the fittest individuals bred with others similarly fit to their ecological niche, while the less fit were less likely to reproduce. The problem with social insects was that while single termites seem to be individuals, they do not function as such. Only the queen and king of a colony breed, so who was the “individual”? By declaring the whole colony the individual, Wheeler said its members made up “a living whole bent on preserving its moving equilibrium and its integrity”.

In the late 1920s and early 30s, the paradigm of the superorganism grew colossal. Instead of studying individual trees, biologists studied forests as superorganisms. By 1931, the concept snuck into popular culture when Aldous Huxley reportedly based the dictatorship in Brave New World on humans as social insects, with five castes. Wheeler proposed that “trophallaxis” – a word he invented for the way insects regurgitate and share food among themselves – was the secret sauce, the superglue of societies both insect and human, and the foundation of economics. But even during the superorganism’s heyday, Marais was alone in his assertion that the mound had a soul.

In Namibia, I went to meet J Scott Turner, an American biologist who has spent decades studying how and why termites build their mounds. It took Turner years of experiments to show that mounds could work a bit like lungs, with interconnected chambers taking advantage of fluctuations in wind speed. Air moves back and forth through the porous dirt skin of the mound by two systems: in big puffs driven by buoyant gases rising from the hot fungus nest (like the sharp intake of breath from the diaphragm), and in small puffs, the way air wheezily diffuses between alveoli in your lungs. Turner suspected that the termites themselves circulated air as they moved, like mobile alveoli. This insight was an entirely new way of thinking about the problem. The mound was not a simple structure where air happened to move, but a continuously morphing complex contraption consisting of dirt and termites together manipulating airflow.

Termites who spend a year building an average mound of 3 metres have just built, in comparison to their size, the Empire State Building. Those who build taller mounds, at nearly 5 metres, have just built the Burj Khalifa in Dubai – 830 metres and 163 floors of vertigo – with no architect and no structural engineer. Such unthinking, seat-of-the-pants design is not possible for humans, who required squads of professionals, advanced equipment and 7,500 people working for six years to build the Burj Khalifa. Working with Turner, engineer Rupert Soar hoped to harness the powerful constructive groupthink that comes from the tiny mouths of termites and their even tinier brains to build structures in remote environments such as Mars. But there were issues: termites, he said, engineer to the point of collapse.

One morning a JCB arrived and Turner directed it to a mound. The JCB’s great blade came down on the top of the mound with a hollow whomp, the first note of a funny little concert. Half the mound fell away with a tumbling clinking clatter – as the shards hit different layers of cured mud they played a tune like a soft xylophone. We pushed in close, enveloped by the familiar smell of socks and bread.

What was left of the mound was a ruined hierarchy. Dirt shards and fungus combs and sculpted mud plinked downward, while termites ran every which way, at first as a sort of gauzy net. Soon they had organised themselves into small streams, and within 10 minutes those streams had consolidated into rivers of running insects. As order was restored, I could see the elaborate scheme of tunnels, rooms, chambers and fungus hidden under the dirt exterior. The spectacle was genuinely awesome – as in jaw-dropping and appalling.

The top of the mound was hollow, with wide vertical tunnels. The interiors of these tunnels were very smooth, and they segued in and out of each other in ropey vertiginous columns like a sloppy braid. Termites make the mounds by first piling up dirt and then removing it strategically in the tunnels. Eyeless, they use their antennae to feel for smoothness, and in the big tunnels they remove everything that is rough. They may even hear the tunnel’s shape.

Termites are often compared to architects for the way they build their mounds, but that is misleading because they don’t have plans or a global vision. What they really have is an aesthetic, an innate sense of how things should feel. When the top of the spire was first ripped off, there were just a few termites in the solitary tunnels at the top, probably listening to the clopping of their own six feet. But cutting into the top allowed in lots of fresh air at once, and activated an alarm system. Some termites ran away from the hole, agitating their brothers and sisters so they could help with repairs. Thousands of worker termites followed the smell of fresh air to find the hole, carrying balls of dirt in their mouths. Within minutes of the JCB strike, streams of termites canvassed the broken side of the mound, moving in a frantic start-stop pattern like a shaky old animated cartoon. I leaned in further and could see that each termite put its ball of dirt down on a ball left by the previous termite, wiggled his or her head, perhaps to get the ball to stick, and then backed away. Where there were two balls there were soon 20 and then 200, then 2,000. Some of these stacks joined up with other stacks at the perimeter of the breaks in the mound to form little bumpy, frilly walls.

Once the area was walled off, the signal from the fresh air would stop and the termites would fill the internal space with more dirt balls and small tunnels, making a sort of spongy layer. Later they would either block it off entirely or would hollow it out and remodel it. The JCB came back in for another swipe, taking away the dirt below the mound to reveal the system of horizontal galleries, tunnels and chambers where the termites live. It reminded me of those diagrams of cruise ships, visualised from the side, with small rooms packed together in a strict hierarchy of function and status from ballrooms and cafeterias to VIP staterooms and steerage bunks. The colony’s hierarchy is not money, of course, but the things that enable its survival: reproduction, child care, food supply and food processing. Some rooms are large, with vaulted ceilings, and walls and floors the texture of tortilla chips. When I looked closely, I could see that they were not so much rooms as places where many foraging tunnels crossed, like the grand concourses of old train stations. Deep within this area was a small capsule where the king and queen lived, making eggs, which were carried to nearby nurseries.

Below the mound lives the fungus, digesting grass. All termites use symbiotic collectives of bacteria and other microbes to digest cellulose for them, but Macrotermes outsource the major work to a fungus.

In some senses the fungus functions as a stomach, but it also has power reminiscent of the Wizard of Oz. Under the mound and around the nest sit hundreds of little rooms, each containing fungus comb. This comb is made of millions of mouthfuls of chewed dry grass, excreted as pseudofaeces and carefully assembled into a maze. The comb roughly resembles graham cracker pie crust, although it varies in colour from delicious beige to decrepit black. The termites inoculate it with a fungus that they have been cohabiting with for more than 30m years.

Facebook Twitter Pinterest Isoptera termites. Photograph: Bryan Mullennix/Getty Images

You can pull the fungus combs out of their little rooms as if you were pulling drawers from a doll’s wardrobe. The comb maze wiggles like the folds of a brain, with the hard, wrinkly piles of chewed grass making the gyri and leaving sulci-ish gaps in between. This is not an accident: as with a brain, the comb design increases the surface area of the structure. Within the gaps are what look like tiny white balloons, which is the fungus blooming. There is nothing accidental about this relationship either, or the construction that holds it: the details are so fine we can barely take them in. The bottom of the fungus comb stands on peg-like legs, little nubbins that hold it up just enough to let air circulate through. One of the grad students beat a small stick against the floors of the fungus galleries, playing something that was almost a tune.

The symbiotic relationship between Macrotermes and the fungus is tight: workers scour the landscape for dry grass, quickly run it through their guts, then place and inoculate each ball to suit the fungus’s picky temperament, tend the comb and snarfle the fungus and its sugars before distributing the goodies to the rest of the family. Then the workers run off to gather more grass for the fungus. Termite and Termitomyces fungus are so interrelated that it’s hard to tell where the mushroom ends and the termite picks up, but within their codependence is a sort of frenemy-type rivalry. (Fungi are capable of deliberately tricking termites. One invasive fungus in termite colonies in the US and Japan pretends to be a termite egg, going so far as to secrete the chemical lysozyme, which the termites use to recognise their eggs. For reasons that are not clear, colonies filled with impostor “eggs” are no less healthy than those without them.)

Prejudiced by our human sense of a hierarchy of the animate termites over inanimate mushrooms, we would be inclined to believe that the termites control the fungus. But the fungus is much larger than the termites – both in size and energy production: Turner estimates that its metabolism is about eight times bigger than that of the termites in the mound. “I like to tell people that this is not a termite-built structure; it’s a fungus-built structure,” he says, chuckling. It is possible that the fungus has kidnapped the termites. It’s even possible that the fungus has put out a template of chemical smells that stimulates the termites to build the mound itself. As I peered at the white nodules, I began to sneeze violently, sometimes with big gasping whoops, and something – it’s hard to even call it a thought, but a particle of one – flitted through my subconscious before flying out of my nose: the fungus is very powerful.

My admiration for the fungus only grew when I learned that Namibian farmers estimate that every Macrotermes mound – which contains just 5kg of termites – eats as much dead grass as a 400kg cow. Late in the day, one of the scientists used a pickaxe to pop the royal chamber out of the nest – the whole complex was the size and shape of a squashed soccer ball, but made of hard-packed finely grained dirt. He cracked it open, revealing the king and queen in a hollow space the size of a cough-drop tin. The chamber had holes on the sides, allowing air and smaller termites to pass through. The king was large and dark compared to the workers, but the queen was huge – as big as my finger. Her legs and upper body waggled but barely budged the fluid-filled sac of her lower body, which pulsed erratically, as though she was a toothpaste tube squeezed by an unseen hand. Her skin was shiny and translucent and the fats inside her swirled like pearly cream dribbled into coffee.

Everyone shuddered: the queen is viscerally repulsive. She offends our sensibilities and she is monstrous. I think the first stimulus to shudder is a reflexive reaction to her body’s pulses and swirls. But then a more intellectual sense of her horror kicks in. “She’s not a queen; she’s a slave,” said Eugene Marais, a Namibian entomologist working with Turner (no relation to the writer of the famous work on termites). Captive of her body, of her children, of the structure of the mound she conspired to build.

Even then, the queen’s more shocking aspects are hidden from us. Her truly stupendous fertility – creating millions of eggs over as long as 20 years – is something we can only infer. Some species of termite queens can clone themselves by producing eggs with no entry-ways for sperm, which then mature into sexual queens with only their mother’s chromosomes, duplicated inside the egg nucleus, to furnish a full set. Imperfect copies of the queen, these knockoffs are good enough to get the job done. Parthenogenesis allows the queen to live, in insect years, pretty close to for ever.

‘A different dimension of loss’: inside the great insect die-off Read more

And yet we do refer to her as a queen. I wondered why. Marais said that when early European naturalists looked into beehives and termite mounds, they saw the monarchies they came from – with workers, soldiers, and kings and queens. It was misleading, he said, and kept us from really understanding what was going on with termites. For scientists, the great danger of seeing social insects anthropomorphically is that it obscures their true insect-ness. In the 1970s and 80s, when the ant scientist Deborah Gordon began studying massive ant colonies in the American south-west, scientists described the ant colony as “a factory with assembly-line workers, each performing a single task over and over”. Gordon felt the factory model clouded what she actually saw in her colonies – a tremendous variation in the tasks that ants were doing. Rather than having intrinsic task assignments, she saw that ants changed their behaviour based on clues they got from the environment and one another. Gordon suggested that we should stop thinking of ants as factory workers and instead think of them as “the firing patterns of neurons in the brain”, where simple environmental information gives cues that make the individuals work for the whole, without central regulation.

And so, these days, one scientific metaphor for the inscrutable termite is a neuron in a giant crawling brain.

Back in the 1930s, the other Marais didn’t write a termite science book, but a book about how humans could understand termites – as a bug, a body, a soul, a force on the landscape. Looking at termites this way changed how I see the world, science, the future and myself.

This is an edited extract from Underbug: An Obsessive Tale of Termites and Technology by Lisa Margonelli (Oneworld, £16.99). To order a copy for £14.61 go to bookshop.theguardian.com or call 0330 333 6846. P&P charges apply in the UK only to orders by phone.

• Follow the Long Read on Twitter at @gdnlongread, or sign up to the long read weekly email here.