You would need a very megalomaniacal emperor who pushes an invasion as a prestige project during a period when China is rich and stable.
You would first need an emperor that could do the same with Korea. Emperor Wudi of Han conquered Gojoseon and set up four commanderies, but three of them were lost within 25 years. On the other hand, Emperors Wendi of Sui and Taizong of Tang had never lost a campaign until they invaded Goguryeo. In both cases, they were able to take several Goguryeo border fortresses, but failed to advance any further. Had Goguryeo been defeated earlier than in OTL, either the Sui or the Tang would have had to face a probable Baekje-Silla alliance, which would have been hard to conquer based on how Silla repulsed the Tang in OTL.
There is a certain size limit to how much any one state can control based on pre-industrial technology and its limitations on speed of communication. China has pretty much reached that size. It had lots of problems trying to conquer Korea several times, and an invasion into the Korean penninsula does not present the problems an amphibious invasion of Japan would entail.
This is oversimplifying the situation. Goguryeo had lasted for over 600 years by the time the Sui invaded, so it had repulsed numerous foreign invaders. On the other hand, Japan was most likely not as centralized like its Korean or Chinese counterparts at the time. If China could figure out how to conquer Korea, and use it as a stable base to invade Japan, it probably would have taken less time to carry out the latter, especially because both would have involved naval operations.
At best, China could likely conquer Japan once and leave a puppet on the throne, and soon after a rebellion by the native Japanese would overthrow them. Maybe a 10-30 year period of "control" that doesn't produce enough revenue to cover the expenses of the invasion and later occupation. Then another emperor comes by and cuts China's losses and Japan returns to the position where it was before.
Assuming that China conquered the Korean peninsula without major problems, I don't see a problem with this suggestion.
The best time for China to accomplish this would be during a stable point in its history, and at a time when it could control Korea as well. Southern Korea is the best staging area for an attack on Japan.
I think if either the Sui or Tang Dynasty succeed in their warsw ith Goguryeo that ends in (probably temporary) conquest of Korea, then a megalomaniacal emperor could probably get the forces needed to attempt a conquest of Japan. In less than 100 years, China loses control of both Japan and Korea.
This is oversimplification as well. There's a very good reason why Goguryeo held out against the Sui and Tang for 70 years and six expeditions. Although there was a 30-year break in between, 40 years is still a long time for a state to resist another that was about 10 times its population. All eligible males in Goguryeo were trained to fight in case of a war, so there was no problem with conscription. Goguryeo also either allied with or maintained tributary relations (usually in Goguryeo's favor) with Khitan and Mohe tribes, and also allied with the Turks, urging them to revolt against the Tang so that Goguryeo would have breathing space. In other words, you would need to make sure that Goguryeo would be isolated from its allies, then break through two lines of fortresses to successfully invade Pyongyang, and finally subdue the southern kingdoms. By the time that someone accomplishes or attempts to accomplish this, it's very likely that there would be border issues with bordering states to the north or west, or an uprising protesting against such a long and exhausting campaign or campaigns.
The main reasons for Goguryeo's fall were political strife among the three sons who succeeded the Prime Minister, including one defecting to the Tang and fighting for them, and Silla allying with the Tang so that both states could converge on Pyongyang. As a sidenote, Balhae, which claimed to be the successor to Goguryeo, was established 30 years around the same area after Goguryeo's fall, and eventually ended up outlasting the Tang. During the transition between states, the Tang never held effective control over Goguryeo's former territories for long.
Sumeragi mentioned this before, but the Yuan could have plausibly conquered Japan if the Korean soldiers managed to convince the Mongol ones. Because Goryeo was a compulsory ally of the Yuan, it sent ships and soldiers for both expeditions to conquer Japan, and in the first one, when the typhoon hit, the Koreans wanted to remain on land, while the Mongols wanted to board the ships. Had the Koreans won out, the invaders would probably not have been decimated, and eventually conquer a significant amount of Japan. Ultimately, however, the Yuan would not have lasted very long, or turn Japan over to Korea for them to administer, so it would only have been a very temporary gain.