In an acerbic 1976 article on AI research, the computer scientist Drew McDermott was the first to contrast the phrases “artificial intelligence” and “natural stupidity”. Four decades later, researchers warn of the threat posed by computer “superintelligence”, but stupidity is still a far greater peril: both the age-old natural stupidity of humans and the newfangled artificial stupidity displayed by algorithms – such as chatbots supposed to be able to diagnose illness, or facial-recognition software that throws up false matches for ethnic minorities – in which we place far too much trust.

An alternative reason to be cheerful about the coming machine takeover is offered here by the eminent scientist and inventor James Lovelock. A chemist by training, who invented instruments for Mars rovers and helped to discover the depletion of the ozone layer, Lovelock is most celebrated in pop culture for his “Gaia hypothesis”. First formulated in the 1960s, it proposes that Earth and its biosphere comprise a single, self-regulating system. Life alters its habitat (eg, as plants seeded Earth’s atmosphere with oxygen) as surely as the habitat alters life. The hippyish name “Gaia”, originally suggested to him in the pub by the novelist William Golding, probably worked against the idea (also called “geophysiology”), but modern disciplines such as Earth Systems Science have absorbed many of Lovelock’s central points.

Machines will need organic life to keep the planet at a habitable temperature – it will suit robots to keep us around

Now, about to turn 100, Lovelock is looking forward to humanity being overtaken in cleverness by its computer progeny. This will usher in the end of the “Anthropocene” – the era in which humans became able to make large-scale alterations to the planetary environment – and the beginning of the “Novacene”. The new age will be marked by the unpredictable marvels to be unleashed by robots (or “cyborgs”, as Lovelock prefers to call them, but of a purely electronic sort) that can think 10,000 times faster than we do, and will program themselves and their descendants in ways that will be beyond all human understanding.

Why is Lovelock so sanguine about such a prospect? There is reasonable cause for alarm about what a godlike AI, if such can be created, might do if it escapes the “box” and assumes control of energy grids, transport and weapons. (An excellent overview of these issues is Life 3.0 by Max Tegmark, an American physicist and founder of the Future of Life Institute.)But for Lovelock, the Gaia hypothesis will save us, because the machines will realise that they need organic life to keep the planet at a habitable temperature. (Even electronic life could not survive on an Earth that veered into runaway global warming.) So, Lovelock argues, it will suit the robots to keep humans around. We might even be happier, as he quotes the American writer Richard Brautigan writing in 1967, when we are “all watched over / by machines of loving grace”.

The hard science behind such speculation is explained – with the help of an amanuensis, Bryan Appleyard – with beautiful clarity, and a characteristic mischievous wit. Lovelock is justifiably proud of his record as a successful scientific maverick, and he especially enjoys trolling the more misanthropic green thinkers who suppose that the proper response to climatic catastrophe is to dismantle industrial civilisation, rather than to intensify our engineering efforts in alternative energy sources and mitigation. “We must abandon the politically and psychologically loaded idea that the Anthropocene is a great crime against nature,” Lovelock declares resoundingly. “The truth is that, despite being associated with mechanical things, the Anthropocene is a consequence of life on Earth. It is a product of evolution; it is an expression of nature.”

The book ranges in sprightly, aphoristic fashion from the geological distant past, to a short history of the industrial revolution, and on to the present age of “deep learning” systems, such as the chess-playing AlphaZero, that effectively teach themselves. There is a ropey running attack on “logical thinking” in favour of intuition, and Lovelock’s outlook is not entirely Panglossian: he firmly thinks, for example, that research into autonomous weapons systems – AI-piloted armed drones, for example, that could take their own decisions about which people to kill – is exceptionally stupid.

As a whole, however, the book is a bracing corrective to the crypto-Christian guilt and self-loathing of much traditional environmentalism. “My last word on the Anthropocene,” Lovelock writes, “is a shout of joy, joy at the colossal expansion of our knowledge of the world and the cosmos that this age has produced.” Deeply aware of the threats we face, he still manages to exude an infectious, almost absurdist optimism: at one point he imagines broadcasting “waste information” out into space as a way of cooling the planet. “I like to think of huge transmitters sited at the poles broadcasting junk mail, unwanted advertisements, banal entertainment and misinformation. What a splendid way to keep cool!” Along with everything else, Lovelock might just have invented a useful application of social media.

• Novacene is published by Allen Lane (RRP £14.99). To order a copy go to guardianbookshop.com. Free UK p&p on all online orders over £15.