Part One. A History of Socialism from 1789-1917
Socialism (as a secular ideology) has it's origins in the French Revolution of 1789. Socialism, Communism and Anarchism were all part of the same ideology for most of the nineteenth century and the terms were used interchangeably.
In 1871, you had the Paris Commune and the repercussions to it led to a split in the "First International" between Anarchists and "Social Democrats" (Communists and Socialists), with Anarchists arguing against a post-revolutionary state and "Social-Democrats arguing for one.
With the failure of the first international, in the late nineteenth century you then had the "second internal", which was a high point of European Socialism. This started to break down after 1899, when Eduard Bernstein published "The Preconditions of Socialism", leading to debates on whether Socialism should be achieved by revolution (which became the Communists) or democratic reform (which became the Socialists).
In 1917, you had the Russian Revolution which led to the final split between Communists (who supported Lenin and the Bolsheviks) and Socialists (who opposed them). The Communists were then organised in to the "Third International" in 1919 which led to the formation of the international communist movement and the spread of Communist principles from Russia around the world.
Part Two. Socialism and Communism from 1917-1945
After 1917, disputes between Socialists and Communists over the use of term greatly confused the issue. Lenin (interpreting Marx) understood Socialism as the lower phase of communism. Hence the USSR was the Union of Soviet Socialist Republics, and was not regarded as full communism, but only Socialist as the transitory stage. Of course, if you happen to be one of the anti-communist "democratic socialists", you are going to dispute that and there are a wide range of analyses that question the Socialist interpretation of the USSR as a "worker's and peasants state" as instead being the "dictatorship of the communist party" as a bureaucratic class.
During the 1920's and 1930's, groups of the far-right recognised that Communists and Socialists were incredibly successful and popular amongst working people. So to draw support away from them, they began to employ socialist terminology, hence the use of the term "national socialism" in Nazi Germany. Even in Nazi racial theory however, there is a clear distinction between "Ayran Socialism" (i.e. Nazism) and "Jewish Socialism" (i.e. Marxism/Communism) as conflicting ideologies.
By around 1950, "Democratic"/Anti-Communist Socialists began to change the very definition of Socialism. Before the Second World War Socialism had meant a commitment to public ownership, typically relying on Marxist economic theories. Afterwards, people began to talk about Socialism, not in terms of being economic system, but in terms of moral values. This eventually calumniated in the "New Labour" period in the 1990s where the Labour Party rejected public ownership but still claimed to be a "socialist" or "social democratic" party.
Part Three. ...Enter American Exceptionalism and the Cold War... 1945- the Present
Now, everything up to this point accounts for the International and European definition of Socialism and Communism. Americans did something completely different.
In the United States, there was never a Socialist, Social Democratic or Labour Party in the same way there was in western europe. Many of the changes brought in by Socialist Parties in Europe, were instead implemented by the Democratic Party under Franklin D. Roosevelt as part of the New Deal (excluding the Progressive era).
The definition of Socialism in America therefore wasn't a reflection of a particular ideology of a particular party. Instead, it evolved to describe nearly any aspect of state activity. As far as Americans were concerned, the state and socialism were interchangable.
F. A. Hayek's book "The Road to Serfdom" (1944) used the example of Germany to argue that Socialism inevitably evolves in to Fascism, Hayek's book wasn't widely published in the UK due to paper rationing, but was a major hit in the United States. Similar theories had been advanced before Hayek such as "The Managerial Revolution" by James Burnham (1941) , which was a influence of George Orwell's "1984".
In the context of the Cold War, this proved useful for equating Fascism and Communism as "socialist" ideologies because they both sought to expand the role of the state in the economy and society. Basically, it meant that the Soviets couldn't use the Second World War to claim to be "Anti-Fascists" because Americans decided they were "red fascists" or "totalitarians".
During the McCarthy era, Americans employed their fear of Socialism to attack anyone who had a slightly left-of-centre political views. It didn't matter whether you professed to believe in the Constitution, civil liberties or democracy because Socialism automatically leads to Communism, so your either a "useful idiot" or pathological liar for Moscow.
Part Four. Socialism: What does it mean anyway?
If the historical evolution of socialism and communism as ideologies and conflicting usages of the terms by their supporters and opponents wasn't confusing enough, there is a particular problem in the use of political language.
Marxism claimed to be a science and therefore claimed that the definition of Socialism and Communism could be objectively understood and that their definition was the only correct one. As Marxism lost popularity, the confusion only grows because western philosophers rejected Marxism's claim to be a science, including it's authority to define the words Socialism and Communism.
Hence, anti-communists could define communism and socialism in any way they saw fit and often in ways to maximise it's negative assocations, particularly in associating socialism with "coercion" and "violence", whilst exonerating capitalism of any association with coercion because it is based on "voluntary exchange" within the market place. Hence suddenly historical abuses such as slavery and colonialism aren't the fault of Capitalism, but of the state- and therefore somehow add to the reason to oppose "socialism".
Moreover, the Marxist definition of Science is basically "heretical" to western philosophical traditions because it treats the principles of natural science as appropriate to social science. Though ideas of history as a law governed evolutionary process were popular in the nineteenth century, by the twentieth century there was a profound movement away from this, asserting that every individual had free will and individual rights and there were no "laws of history" and that Marxism wasn't a scientific study of reality, but merely a social construct- or a "dogma", "faith", "religion", "ideology", etc (which ever term you prefer- they all generally mean the same thing- Marxism is "false" or "wrong"). The definition of Socialism and Communism were thus casualties of these disputes over the nature of truth, knowledge and science, because philosophers thought that language was a series of symbols which did not necessarily reflect an objective reality. abstract concepts such as "ownership", "property" and "means of production" thus started to lose all decipherable meaning entirely because they were treated more as opinions and less as objects of scientific study.
We are hence left with a legacy where Socialism and Communism are philosophically considered undefinable due to the limitations of our understanding of the meaning of language, and are politically defined by the victors of the Cold War to mean anything and everything that opposes the interests of rich people or involves the state in some tenuous way.