Communism was a political ideal that means the well-being for all.
"This rich endowment, painfully won, builded, fashioned, or invented by our ancestors, must become common property, so that the collective interests of men may gain from it the greatest good for all. There must be Expropriation. The well-being of all--the end; expropriation--the means."
Quote: Anarcho-communist Prince Peter Kropotkin, London, 1892
This ideal was embraced by a number of nation states on Earth during the 20th and 21st centuries, these nations states weren't really communist at all, they were Marxists, they were authoritarian socialists. The most notable of those were the Soviet Union and People's Republic of China.
Communism have to be divided into the authoritarian socialsm aka marxism and the anti-authoritarian socialism aka anarchism. Marxism was a political ideology founded by Karl Marx, which purported to create an economic system of enforced equality for all people, via extensive governmental oversight of national economies. The ideas of Marxism were eventually used to herald an authoritarian ideology in the states where it was implemented. During the latter half of the 20th century, the competition between free-market capitalism and communism constituted the Cold War.
In the United States of America and a number of other nations, pejorative slang terms came into popular use for people who were proponents of communism, which included "pinko", "red" and "commie." When Captain Benjamin Sisko was experiencing visions sent by the Prophets, the character of Douglas Pabst had insinuated that Herbert Rossoff was a proponent of communism. (DS9 episode & novelization: Far Beyond the Stars) Similarly, Professor Eugene Eckhart accused Gary Seven of being a communist, along with all opponents of the Vietnam War. (TOS - Star Trek: Assignment: Earth comic: "My Name Is Legion")
By the late 20th century, the shortcomings of Soviet style communism became apparent - the country was suffering economic hardship brought on by extensive military spending and inefficiencies of central economic planning. Soviet leader Mikhail Gorbachev began a program of perestroika, or "restructuring," to liberalize the Soviet Union - which was to include the elimination of corruption, simplification of bureaucracy, and production improvements. Hardliners in the Soviet government attempted to roll back the reforms by staging an attempted coup in late 1991, which failed within a few days when the leaders of the coup were unable to consolidate power. After the coup was defeated, many of the Soviet Union's constituent members began to assert their independence, and the Soviet Union was dissolved on 25 December 1991. (TOS novel: Probe)
At the least, some of the ideals of communism survived in Russia into the 23rd century. When the senior staff of the late starship USS Enterprise traveled back in time to 1986, Pavel Chekov explained to Admiral Kirk that they would not have needed money if they landed in Russia. Several bystanders overheard Chekov apparently praising communism, leading one bystander to mutter that Chekov was a "...pinko commie exchange student." At this point, Kirk cautioned Chekov to not antagonize the Americans of the time by praising communism in their presence. (TOS novelization: Star Trek IV: The Voyage Home)