Because adopting western technology and economics is a lot harder than it seems. Also, you have this treadmill effect. By 1870, China had adopted all of the technology and systems it needed to defeat 1830-Britain, but by that time it was fighting 1870-Britain, and there were huge leaps in technology between 1830 and 1870.

The other thing is that the Chinese government was a lot less strong and unified than most people think. It managed to survive several major civil wars between 1830 and 1860. Also, big is a handicap when trying to change a system.

Personally, I think that the Qing dynasty did rather well in comparison to say the Ottomans.