Please put lots of examples and evidence. Thanks! I'm pretty new to this subreddit. :)
Just to add my two cents to the already quite comprehensive answer in this thread.
I think another major reason why China was slow to modernize compared to Japan was due to the fact the last dynasty (Qing) had the minority Manchu ruling over the majority Han.
After a brutal conquest, the Manchu overthrew Ming and established the Qing dynasty over China in the 17th century. It faced constant rebellions but was mostly successful in quelling them with the support of Han elites and landlords.
After the Opium War, any sane ruler would seek to reform and adapt, and that's what some Qing emperors and princes tried to do. However, they quickly realized that an earnest effort to modernize would mean releasing the various controls on the Han majority which kept them in power for the past two hundred years, such as eligibility to government office and military posts, ownership of gunpowder weapons, access to education and foreign ideas, international trading etc. With a population far smaller than Han and already largely sinicized, the insecurity was escalating every time the reformists tried something new.
Fearing that a full modernization effort would give the local Han governors and elite class far too much power, effectively ending the dynasty, the conservative faction of the Qing ruling class ferociously fought every effort to modernize. They even sacked and imprisoned Emperor Guang Xu, who tried to imitate the Meiji Restoration with the help of some Han scholars.
If the last Chinese dynasty was a normal Han dynasty, it wouldn't be surprising to see China going down the road of its own Meiji Restoration, or something similar to the British "Glorious Revolution", and turn itself into a constitutional monarchy instead of a Republic. China with more than 2,000 years of imperial legacy, would have an easier time adapting to the "new normal" instead of repeating cycles of civil wars.