There are a number of reasons why the communists were able to defeat the nationalists in the Chinese Civil War that took place both before and after World War II (and even, to some extent, during WWII). In general, the communists won because had more foreign support, and were more popular with the people.
The Chinese people as a whole tended to be very poor during the Chinese Civil War. They had also typically been treated rather poorly by those in power for much of Chinese history. This meant that the people were ripe for a real revolution. The nationalists did not have any radical changes to offer. By contrast, the communists talked about land reform and about creating a country in which the lower classes would have the power. This was very popular with many common Chinese people and helped the communists win.
Second, the communists had a relatively strong ally with good supply lines into China. The Soviet Union wanted the communists to win. The Soviet Union was probably the second strongest military power in the world in 1949 and its help was very useful. The US did support the nationalists to some degree, but the US was not as enthusiastic about it as the Soviets were. Even if they had been, it is much easier to get supplies from the USSR to China than from the US to China. This gave the communists a military advantage.
These were the two most important reasons why the communists won the war.
Although the communists were severely disadvantaged in many areas, controlled only the periphery regions of China and were militarily inferior (since most of their troops were not well-trained), they did, however, receive massive support from the locals. This was largely attributed to the fact that they had publicly resisted against the Japanese through the Eighth Route Army. The communists also proved extremely adept at mobilising the peasants, which allowed the party to gain a relatively stable source of manpower. The communists’ leadership was too internally united and cohesive - they had identified their main concerns regarding China and were committed towards uniting the country under nationalist rule. In contrast, the Nationalists were split internally due to presence of factionalism and corruption. The party was also able to use propaganda effectively to their advantage. The Nationalists were portrayed as the enemy of all Chinese and the communists as the saviour and representative of China, a party that was determined to build a new China free from the old order. Such ideas appealed to Chinese supporters, who were increasingly disappointed with the Nationalists and allowed the communists to gain support from areas that the Nationalists had previously controlled. The communists also received much-needed assistance from the Soviets. They gained stockpiles of Japanese weapons and access to Manchuria, a vast region with extensive food reserves and resources, as a new base. Such factors allowed the communists to launch a successful counterattack against the Nationalists - the People’s Liberation Army won successive victories in Manchuria, North and South China.