"Socialism" is any economic system in which the "means of production" (meaning factories, shops, transport systems etc) are controlled by the community as a whole rather than by a small class of owners. This is a very broad definition and there are lots of variations on the theme. Wikipedia has an overview.
"Communism" is one of these variations. It is based on the thinking of Karl Marx. Although Marx did not originate many of the ideas in communism, he was the one who first organised and systematised the ideas of other socialist writers.
Marx saw an inevitable historical progression of society through a number of stages, starting with "Primitive socialism" (i.e. tribal village life), through Feudalism, then Capitalism, then Communism. The transition from Capitalism to Communism would include a phase of the "Dictatorship of the Proletariat" in which the workers would seize both the means of production and the machinery of the state, effectively replacing the current power structure with their own. During this phase the workers would see a great rise in their standard of living because the parasitical owner class were no longer taking the products of their labour. Because the workers were now working for themselves they would also be able to organise their own work instead of having bosses order them about, which would lead to a further increase in efficiency. This would in turn lead the mechanisms of state control (police, taxation, money etc) to wither away as they were no longer needed. Hence the Dictatorship of the Proletariat would evolve into a classless utopia in which people would only work when they wanted to at whatever they wanted to, and everyone would have as much as they needed.
Of course it didn't work out like that.
Marx expected that the advanced capitalist societies, notably the UK and the USA, would be the first to see revolutions and a transition to the Dictatorship of the Proletariat. In fact it was the feudal USSRRussia and China that saw the big communist revolutions. These societies successfully instituted the dictatorship of the proletariat. However the expected evolution into a class-free worker's paradise failed to materialise, and "communist" countries remained stuck in the dictatorship of the proletariat. It is this phase that most people equate with the word "communist".