Britain had lot of debts to pay to China after importing tea from there. So, the solution was to export the drug opium. They had a lot of opium after conquered Indian Bengal.
Confescating Boxes of Opium
Emperor Yongzheng had banned the sale of smoking of opium in 1729 in China, but the demand for the drug remained.
British Empire going to the Pearl River (Canton)
William Jardine, James Matheson and other businessmen went out to fulfil their demand. British authorities did not stop them because selling drugs will increase their profit which will the GDP of Britain.
The Chinese government was not happy with this settlement . In they year of 1839, Emperor Daogang declared a war on drugs and had his soldiers raid warehouses which was controlled by the British traders, amd so they confescated around 20,000 chests of opium.
The British government decided in early 1840 to send an expeditionary force to China, which arrived at Hong Kong in June. The British fleet proceeded up the Pearl River bay to Canton, and, after months of negotiations there,attacked and occupied the city in May 1841. The Chinese troopscounterattacked in the spring of 1842. The British held against the offensiveand captured Nanjing in late August, which put an end to the fight.
Peace negotiations proceeded quickly, resulting in the Treaty of Nanjing, signed on August 29. By its provisions, China was required to pay Britain a large indemnity, cede Hong Kong Island to the British, and increase the number of treaty ports where the British could trade and reside from one (Canton) to five.