The newly refurbished National Museum of China opened in March 2011 in Tiananmen Square, adorned with groundbreaking technology and architecture. But the story it tells is far less innovative than the design. In the museum's narrative, China's modern period of history opens with the opium war, the original sin of western imperialism in East Asia that forced China to open itself to a century of humiliation, conquest and exploitation until Chairman Mao came to sweep all that away. It's titled "The Road to Rejuvenation", but it could just as easily be called "1842 and all that". This version of the past says more about contemporary Chinese politics, still drawing on China's history as a victim of western imperialism, than it does about the reality of the clash between the 19th century's greatest land and naval empires. Even in a 21st-century museum, the stain of a history more than 150 years old is central.

Yet not all the simplified views are on the Chinese side. One of the most persistent excuses for the British invasion of China, when it is discussed at all, was that it opened up a closed, xenophobic empire to the outside world. Actually this was never true. The China of the Qing dynasty was at the heart of an international system looking west and east, expanding its territory by conquest and by treaty in central Asia, and building contacts with Korea, south-east Asia and even Japan (never quite as closed as its shogun rulers would have liked to believe). China also took part in an intellectual and commercial network that went beyond Asia, as the influx of blue-and-white pottery in English country houses in the 18th century easily demonstrates. And long before the British arrived, China was even ruled by outsiders, the nomadic Manchus who had galloped in from the north-east. By the time of the opium war, they had spent nearly two centuries combining traditional Manchu culture at court with the Chinese traditions of governance across the empire.

Julia Lovell's new history of the opium war is a welcome piece of myth-busting. It uses a wealth of Chinese and British sources to tell, in her words, a "tragicomedy" that is "far more chaotically interesting" than the ideological positions on both sides might suggest. The tragedy part is as simple as it was in 1839. British opium from East India was brought into China in huge amounts from the early 19th century. In the 1830s, concern about the drug's effects on the population and economy led the Qing dynasty to ban it, and they ordered a senior official, Lin Zexu, to blockade British opium ships in Canton harbour until they agreed to hand over their cargo. In Britain, this was seen as an insult to the Crown (much of the opium was produced by the East India Company), and a fleet under Admiral Charles Elliot was sent out to teach the Chinese a lesson. British military technology soon smashed through Chinese defences, and after three years of coastal fighting, the war ended with the Nanjing treaty of 1842 which handed over Hong Kong island and opened up the interior to trade and Christian missionaries. For the next century, China would be subject to further invasions and humiliations, which ended only with the termination of special western rights in China in 1943 under Chiang Kai-shek (not under Mao in 1949, as the Chinese Communist party tends to suggest).

The comedy part lies in the characters whom Lovell paints with affection and a dry wit. Lin, the upright official tasked with destroying the opium he had seized, had "self-belief" and a "passion for freight management". Lord Palmerston, who sent the fleet, is described as "Free Trader, libertine, arch-villain of Chinese historiography". The gulf in diplomatic niceties between the two sides was shown particularly starkly in the run-up to the signing of the treaty, when one high official insisted that he must first feed sugar-plums directly into the mouth of the British negotiator Sir Henry Pottinger, who showed, in the words of a witness, "determined resignation after he found remonstrances were of no avail". The book also paints the many shades of grey: for instance, voices such as William Gladstone, who declared "a war more unjust in its origin, a war more calculated … to cover this country in permanent disgrace, I do not know, and I have not read of." And the Chinese officials, from Lin to the high Manchu official Qishan, come over not as arrogant xenophobes but as worried, sincere men faced with their civilisation in existential crisis.

The opium war did help to bring about the collapse of the last Chinese dynasty, a fact worth remembering in 2011, exactly a century since the revolution that deposed the last emperor. But their significance was to hasten violent changes already under way. The expansion of China's territory and population, without any increase in the size of the bureaucracy (shades of current debates about austerity versus spending in the west), meant that government functions had become less competent and more corrupt. And while the opium war itself had a direct impact on relatively few Chinese, one of the results of the opening up of China demanded by the 1842 treaty was the Taiping war of 1856-64, when a lunatic inspired by Christian missionary theology managed to spark off one of the bloodiest civil wars in history, which killed some 20 million people. Throughout the 20th century, the opium war has remained a rallying-cry for Chinese nationalists seeking to overcome "national humiliation" and restore China to its rightful place in the world.

Lovell's book is part of a trend in understanding the British empire and China's role in it. Earlier this year, Robert Bickers's The Scramble for China gave a compelling account of the aftermath of the opium war, which saw such a heightened presence of British missionaries and adventurers that the Shanghai lifestyle was nicknamed "the Mock Raj". Niall Ferguson's recent Civilization revived the argument that there was a distinct western imperial modernity that was more successful than any other system from the 18th century onward, but he framed the book as a comparison with China in the 17th century and in the early 21st, a device that would have seemed unlikely just two decades ago. Lovell's major contribution is to remind us of the different worldviews involved: not so much a clash of civilisations but two sets of incompatible software, as we read, over and over again, a British politician give one view of events, and a Chinese official define it in completely different terms. The sense of an unfolding tragedy, explicable but inexorable, runs through the book, making it a gripping read as well as an important one.

The opium war is capable of creating waves in China even today. One academic, Mao Haijian at Peking University, recently had the temerity to question the official Chinese narrative of the opium war in his book The Collapse of the Empire, rehabilitating the Qing official Qishan, generally regarded as the weak villain of the piece who failed to stand up to the British, and criticising Lin, traditionally regarded as the upright hero of the story. His book was subjected to a storm of criticism, but the debate did not result in the purging of the dissident scholar, as it would have done in an earlier era. The signs of a livelier debate among Chinese academics make the account of the war in the new national museum even more disappointing. Britain may have forgotten the history of its Chinese empire, but the Communist party also continues to be highly selective in what it chooses to remember. The conquest of China by Mao in 1949 was not an endpoint to the story started in 1842, but brought its own horrors of history with it: the Great Leap Forward and the famine that killed millions of people (described in Frank Dikötter's recent Samuel Johnson-prizewinning book), the cultural revolution (officially repudiated and hardly mentioned in the new museum), and the killings of non-violent students and workers just a few hundred metres from the site of the museum in Tiananmen Square in June 1989. This book serves a crucial purpose in reminding Britain of a shameful episode in its past that still shapes relations with China today. But official China could also learn from it that reconciliation with the past comes by understanding its complexities, rather than turning it into a simple morality tale.

Rana Mitter's Modern China: A Very Short Introduction is published by Oxford University Press.