This really isn't a simple answer, there are a hundred factors involved in this, from military might, to economics, to it being practical.
A practical invasion on Chinese soil wouldn't be something the United States is interested in for several reasons. They have a strong standing army and advanced technology. They're also the largest exporter in the world and American business and economics rely on them for cheap products.
You should also consider the fact that North and South Korea were two broken states. The north was being heavily influenced by Russia, while the South resisted the red wave. It was really a "scare" at the time that Communism was spreading. China was already Communist long before America was truly considered a "world power," by any means. Involvement in the Korean war meant more military presence in the area and the prevention of Communism further spreading.
Obviously, there are other reasons, but those are the mains ones. To sum things up, we didn't invade China because: Military force and economics, while we funded proxy and cold wars in Korea to prevent Communism