The British had attacked China in the Opium War because China had terminated trade of opium from the British and burned all opium they could find in China. The British saw this as a form of aggression and therefore sent their troops.
The problem first rooted with tea (that was a pun :D). The British wanted tea and China had tea, but China wanted silver. Eventually, the British decided to buy the tea and sold China opium instead. This went well at first until China saw the effect opium had on their civilians. So China banned it, and burned any speck of opium. This got back to the British and they sent their troops.