In the 1800s, the British were in the same position that the Americans find themselves in today. Their balance of trade was heavily skewed. They bought a lot of Tea from China but had nothing to offer them.
They discovered that it was easy to get the Chinese addicted to opium, and the sales of opium were slowly rising. The British destroyed the agricultural belts in Bihar and forced the farmers to grow poppy instead of grains. These were then processed using forced labour and then exported to China.
Bombay and Calcutta grew immensely on the back of these exports. But the cities also developed their own addiction to opium. Many Opium dens opened up in both cities to cater to customers who wished to smoke it.
Source: Opiate Addiction Resources
Since smoking opium made a person lethargic, it was normal to lie on the hip and smoke it. Hence, opium smokers came to be known as hipsters.
By the turn of the millennium, the word was taken to America and its meaning changed to indicate someone who is culturally savvy and conscious of trends.