db0 has begun a good series correcting many misunderstandings about communism.
Misunderstanding Communism I: It’s not USSR
Misunderstanding Communism II: It’s not a religion
There are some who would dispute db0 and say that Stalin (and Mao) really were communists, and place the fall of communism at Khrushchev & Deng. Personally, my opinion of both leaders is so deeply colored by Western propaganda that I'm agnostic awaiting further investigation.
Be that as it may, there are several things that one must keep in mind that we do know. Both pre-revolutionary Russia and China were desperately poor in a purely material sense. Both Russia and China had been profoundly authoritarian societies for millennia; neither had very much connection with the philosophical and political tradition of Western Enlightenment. Marx noted that all societies inherit from the past not only the means of production but also the political superstructure. Any western communist society would likely be very different from the USSR & China because we would be inheriting very different economic and political traditions.
Both countries (but especially the USSR) were threatened with imminent attack; the Soviet Union was in fact attacked by Germany because the USSR was communist. The USSR had to recover from WW-I (the classic internecine imperialist war), the civil war (with the rebels provoked, aided and abetted by anti-communist capitalist, imperialist countries) and WW-II (a nakedly imperialist war of aggression). The Soviet Union could not have looked on Patton's desire to keep rolling into Moscow, nor the obvious hostility of the West towards the USSR during the Cold War, with anything other than the best-justified paranoia; just because you're paranoid doesn't mean they're not out to get you.
The historical record seem crystal clear on Hitler: he intentionally and deliberately murdered millions of people simply because he didn't like them. The historical record is much less clear on Stalin and Mao: Did millions of people die? Probably. But the question is: Did they die because Stalin or Mao simply didn't like them? Or did the people die because the leaders made blunders trying to recapitulate in a couple of generations (with their very survival at stake) the economic and political developments that took the West centuries to achieve? And, especially in Maoist China, did many of those people die simply because people had been dying from natural causes (famine, drought, flood, etc.) by the millions from time to time in China for millennia? Mobo Gao (The Battle for China's Past) notes that four million people fewer people died in China during the time of the Cultural Revolution than in India during the same period.
Keep in mind too that the West has had its share of blunders causing the deaths of millions. Even excluding the almost continuous warfare, just the Spanish Flu — in no small part a consequence of the massive, rapid urbanization of the Western population — killed 20 million people. If communism must be called to account for its blunders (and it must), capitalism does not deserve a free pass.
To what degree are the people who died under Stalin or Mao (especially Mao) offset by those that were saved? Compared to both societies before their revolutions, what was the improvement in material standards of living and medical care, both of which profoundly expect both life expectancy and quality of life? Yes, many people lived in grim, poorly constructed apartment buildings after the revolution, but many were living in mud huts before the revolutions.
Too many people, I think, fault the USSR and the PRC for not catching all the way up to the West, for not achieving in 50 years what the West achieved in 500 years.