Lots of good answers here - it's the kind of question where lots of explanations are partly correct. For me, the decision by early communists to advocate for violent revolution as the only or main way of bringing about communism is a key factor.
It's pretty common for revolutions to produce dictators, going right back to the fall of the Roman Republic. Ironically, the Roman Civil War that preceded the fall was won by the populares - the people's movement, as opposed to the optimates, the aristocracy. And yet, the end result was the abolition of the tribunes, which had been the people's branch of the legislature, and the establishment of the Dictatorship of Julius Caesar, then the Principate of his nephew, Augustus, who we now regard as having been the first Roman Emperor. It wouldn't be accurate to project back our exact ideas of democracy or class politics to the Romans, but it's pretty telling that one of the first explicitly 'class-based' civil wars in history turned out this way.
Many centuries later, the Wars of the Three Kingdoms in the British Isles had a similar outcome: the royalists were defeated by the parliamentarians, only for the victorious generals to set up one of their own as what we would now call a dictator (Oliver Cromwell as 'Lord Protector'), who was virtually a king himself.
(Worth noting here that many people assumed George Washington would turn out to be another Cromwell. The fact that he didn't and the question of why he didn't, is not something I know enough to even begin to speculate about, but is definitely something to look into when trying to understand this topic.)
Most relevant for the early communists was the French Revolution, which led to the rise of Napoleon Bonaparte who, more or less explicitly imitating Caesar and Augustus, made himself sole ruler of France, first as 'Consul' (a title also borrowed from Classical Rome), then Emperor. He was also followed, a little later, by his nephew doing a very similar thing, again explicitly imitating the Romans.
Ironically, Marx himself wrote about this exact tendency, even calling it 'Bonapartism', to warn revolutionaries to try and avoid it. I don't know how exactly he missed the point that the very thing he elsewhere advocated for - violent revolution - was itself the cause of Bonapartism but it seems he did. Plainly, the early Marxists didn't sufficiently heed this warning, for whatever reason (and see other replies in this thread for many good suggestions!).
Basically, if you're going to advocate for the violent destruction of a system of government, you are running a major risk that in the ensuing chaos, someone very good at being violent and decisive will end with far too much power.