Forgive me if this question is too political for a history sub.
In short, China, Japan, and Korea closed their borders in an attempt to keep foreign powers out so that their states would remain soveriegn. the industrial revolution that happened in the west gave the west military superiority over the east asian countries, and made them force open their ports. In Japan, it was the efforts of Commodore Matthew Perry, and with China it was the British with the First and Second Opium wars that eventually crippled China to the point that they could no longer fight, and forced them to surrender in 1860.
Japan accepted modernization much quicker than China, using the Iwakura mission to discover the means to modernize and become an Imperial power much like the rest of the western powers so that it too, would no longer be under the subject of western rule. Between the Sino-Japanese war and the Russo-Japanese war, Japan had manuevered itself to colonize Korea, and Korea recieved modernization through Japanese development.
China's modernization was much slower, but after several in faction struggles, the communist party became the majority leader of the politics, allying China with the USSR, and China became more developed through aid from the USSR.
Hope this helps!