The Qing banned the import of British goods, so the British sold them opium. This unfortunate course of events led to the Opium wars. But why did the Qing ban British goods?
Were they inferior? Did the locals in Canton feel that way, or are these the words of the Emperor? Did the Qing government have other motives? Is it because the British hadn't accepted China's standard tributary bilateral trade system? Did the Qing know about British colonialism in India? Of the technological items, did the Chinese not understand them?
It just seems counterintuitive that a country with such inferior goods could then go on to dominate another 100 times its size on the other's home turf.
The quality of British goods had nothing to do with trade restrictions imposed on Europeans, and the heavily reliance on the Canton System to conduct commerce with foreigners. Rather the Qianlong Emperor's (r.1735-1796) abject refusal to accept British manufactures when pressed was born of more complex diplomatic manoeuvring.
The Qianlong Emperor was consumed with both a desire to limit European influence on the Chinese people (the Qing court at this point was well aware of Britain's actions in India as well as the behaviour of its merchants in China such as Captain John Weddell in 1637, and the Portugese prior) and ensure his control over his subjects was not undermined. Writing to his Grand Minister, the Qianlong Emperor notes:
Among the western ocean states, England ranks foremost in strength. It is said that the English have robbed and exploited the merchant ships of other western ocean states so that the foreigners along the western ocean are terrified of their brutality.
The Qianlong Emperor publicly denied interest in British wares (quoted as "I set no value on objects strange or ingenious, and have no use for your country's manufactures." in a never-received letter to King George III) - but this was deceptive. Indeed British envoy George Macartney was well aware of Qianlong's personal collection of European 'spheres, orreries, clocks and musical automatons' which seemed to contradict this stance, and indeed of the massive potential market Qing China represented. Through both observation and experience the British manufacturers were certain a massive consumer base awaited them if trade could be properly negotiated. Historical record does not indicate domestic Han Chinese sentiment itself was at all opposed to the arrival of European goods in the slightest.
Thus Qianlong's stance can be seen as a strategy of imperialist authority, in refusing European goods Qianlong was elevating the Qing status internationally and ensuring his own domain wasn't subverted by foreign influence. Ruling as a Manchu minority in an overwhelmingly Han Chinese state, the Qing court was equally all too aware of the political currency multilingualism afforded and likewise restricted European access to communicate independently with the population. The borderline obsession of the Qing with securing both its borders and against internal strife was read by European nations [especially the British] as xenophobia and ramped up the pre-war rhetoric which the opening of the Opium War was exacerbated by.
Finally there is a strong economic argument for restrictions on European trade. Before the opium trade took off in the mid to late 18th century, the British obsession with Chinese tea imports resulted in a trade deficit, languished over by British economists and merchants alike, which left the British paying exorbitant amounts of silver to the Qing state in exchange for the tea. 200,000 pounds was sold in London by the British East India Company in 1720, but this number increased to a million by the end of the decade. This exchange of silver for tea was enormously beneficial to the Qing state [until opium subverted silver as the dominant trade good at the end of the 18th century] and will certainly have influenced Qing policy-making towards European exports.
Sources:
The Opium War - Julia Lovell
China: A History - John Keay