I don't think Japan is better at adapting foreign ideas. In fact I think it's a lot worse than China who actually had to deal with foreigners throughout it's history. Looking at modern times as reference where the average people have even worse English than China who was literally closed off from the world for a while and are more ignorant about the world on how things actually work. It's an island after all. But unlike the Brits they made no interest in exploring the world and in fact did the opposite for a while before modernization.Japan modernized faster because it was “right-sized”: large enough to have resources and complexity, but small enough to coordinate elites quickly, while China’s scale made coordination slow and interests divergent. Culturally, Japan was also much more adaptive to foreign ideas, as Japan was a peripheral civilization that was quick to absorb ideas and institutions from the dominant core civilization, whereas China was the dominant "universal," civilization that had seen itself as the center and source of civilization for millennia. Japan was further boosted by preferential investment and aid from many European powers, whom saw Japan as useful to containing Russian expansion in the Far East.
Qing did modernize, but at a slower and more uneven pace. Uncontrolled modernization could potentially pose a threat to central state power, and ultimately did lead to the downfall of the dynasty.
What helped is Japan was just the right size. Emperor Meiji could gather enough resources and men to kill off all the samurai/military generals who opposed him and his reforms. It's funny how modern Japan jerks off it's noble samurai so much yet gives little attention to this part. I've seen more media from the west covering this like the Last Samurai or that Shotgun 2 expansion pack game.
Qing china is just too damn large. Imagine current china with outer Mongolia and Taiwan as well but with much slower pace and a lot more morons in government. You will need at least 100 years to get anything done and Europeans had battleships just parked outside the shores.