Did the Communist Party in the USA, or any other ideological party other than capitalism, ever gain considerable power in the USA, and why is capitalism still the leading ideology in America?
The US was not without agitators for Communism. The US Communist Party openly advocated for Socialist policies in the US. The problem was that they were seen as seditionists at the time. This lead to the first red scare
The first Red Scare climaxed in 1919 and 1920, when United States Attorney General Alexander Mitchell Palmer ordered the Palmer raids, a series of violent law-enforcement raids targeting leftist radicals and anarchists. They kicked off a period of unrest that became known as the “Red Summer.”
While there's more to that story, the important thing to note was that Communist supporters in the US (some of whom were black) were not in power, and were often brutally put down by others (the Red Summer of 1919 saw many blacks murdered, regardless of their views). It helped to blunt the impact Communism would have politically.
World War II helped to galvanize resistance again. During the war, the Soviets saw an opportunity to expand Socialism to other countries, and the US realized they had to combat this expansion. This helped lead to the rise of people like Joseph McCarthy, and the infamous House Un-American Activities Committee
The House Un-American Activities Committee (HUAC), a committee of the U.S. House of Representatives, investigated allegations of communist activity in the U.S. during the early years of the Cold War (1945-91). Established in 1938, the committee wielded its subpoena power as a weapon and called citizens to testify in high-profile hearings before Congress. This intimidating atmosphere often produced dramatic but questionable revelations about Communists infiltrating American institutions and subversive actions by well-known citizens. HUAC’s controversial tactics contributed to the fear, distrust and repression that existed during the anticommunist hysteria of the 1950s. By the late 1950s and early 1960s, HUAC’s influence was in decline, and in 1969 it was renamed the Committee on Internal Security.
During this time, the US and the Soviet Union were engaged in what became known as the Cold War. This helped keep Communism at bay, since the obvious difference between the two countries was their economic system (underpinned by dramatically different politics).
It's only been since the 2016 election cycle that Socialism itself could be spoken of in the US. They mostly do this by watering down what Socialist means
To counter the supposed connection with authoritarianism, he defines socialism of the sort promoted by the Boulder County DSA as "the expansion of radical democracy not just in our political system, but also in our economy at the national and local levels and in our workplaces, including having a measure of worker control. There are various means to accomplish this, but it's important to have a say in these systems that affect your life and control your livelihood — to help influence how they're built and run."
The US began its life as a British colony, And colonialism is (almost by definition) an exercise in rampant capitalism. The entire point of a colony is to lay claim to a territory, drive out or subjugate the natives, and extract resources like tea, tobacco, cotton, minerals, gemstones, exotic fruits, or what you will to ship back to the motherland as commodities. Even after the US broke free from Britain it continued in the colonial vein, expanding westward looking for arable land and pasturage, gold and silver and copper and iron, until it finally ran out of 'West' in Alaska and our few pacific territories.
That happened in the early 20th century, and (what with World War I and the Great Depression) we had a moment of socialist lean with the New Deal. But soon after that we shifted from colonial capitalism (territorial expansion to capitalize new resources) to commercial capitalism (expansion to capitalize new workforces and consumer populations).
We had another burst of quasi-socialist thinking in the 60s and 70s, based around the civil rights movement and various offshoots like feminism and gay rights. Then we shifted into the still-extant system of market capitalism: a byzantine game of capitalizing commercial forces themselves, in order to skim profits off the top.
The point is that certain powerful segments of our society have always been geared exploitive capitalism, beginning before our country was even formed. This segment has managed to consistently adapt to changing contexts, shifting the focus of conquest from territory to commerce to the markets themselves without ever losing that 'conquest' mentality. While there have been periodic uprisings of Liberal ideals and policies, such have always de-evolved to a matter of redressing wrongs rather than pursuing positive goods, so that capitalist mindset still dominates.
I would like to elaborate a bit on the answer of user "Mikesplace". Though his reply is rather polemic, there might be a genuine case to be made that the US and other Western nations have adopted a number of practices characteristic of communism, which are similar to those seen in formally communist countries.
Early "Socialism" in the US
Immediately after the revolutionary war, two distinct political factions arose. One, led by Thomas Jefferson, advocated free trade and a minimalist government with no power to intervene in the economy. The other, led by Alexander Hamilton, favored protectionism and a strong executive with the power to subsidize industry. These two groups struggled for dominance during the first few decades of US history until the Civil War, when the expansion and consolidation of centralized federal power effectively tipped the scales in favor of the "Hamiltonians".
This is not to say that Hamilton or his supporters were "communists" in the established sense of the word, but it goes to show that the notion of the US being inherently "laissez-faire" is a bit misleading. From the very beginning, there had been ideological support for the type of political direction of the economy (as opposed to market forces), that later socialists would favor.
The progressive era
By the 1890'ies both parties had for all intents and purposes abandoned strict adherence to a "night-watchman-state". In the time period surrounding WWI the intellectual fashion among US elites dictated that society should be guided and rationalized along scientific lines by "experts". This "progressive" movement established public social programs and compulsory, state organized education.
The belief in "scientific expertise" also led to numerous federal agencies responsible for regulating industry. In practice, these agencies allowed politically well-connected owners of major corporations to cozy up to regulators. By subordinating themselves to regulation, they could effectively cartelize their industries and cement their market shares, as smaller firms have a much harder time competing if they also need to comply with ever changing rules. Apart from railroads and the oil-industry, this included the provision of health care. Perhaps the most important example is the creation of a central bank. By politically cartelizing the banks, it became easier for governments to take on debt or fund their activities by printing additional money.
While this was not done with the explicit intention of establishing a socialist society, it is not difficult to see how the institutions and precedence established during the era run parallel to the wishes of contemporary socialists; an active central state, which directs economic activity, vassalizes industry leaders and provides social services.
The New Deal
During the Great Depression the progressive Herber Hoover, who was federal "food Czar" during WWI, was one of the first leaders in history to apply government intervention as a cure. In line with the progressive world view, his policies increased public spending and debt, prevented wage cuts in industry, had the central bank lower interest rates and raised tariffs on foreign goods. One can also mention subsidies to banks with the aim of preventing unemployment or the public provision of loans for home purchase.
Hoover's refusal to further expand this strategy led to his defeat at the hand of FDR, who further centralized political control over banking and industry. A major innovation was bringing labor unions in to the progressive fold by introducing federally enforced labor regulations and recognizing collective bargaining. On top of this he even ordered the confiscation of precious metals held by private citizens.
If one were to simply list these initiatives, it is not difficult to see that they would have appealed to committed socialists. Hoover's prevention of wage cuts and FDR's approach to labor regulation were obviously among unions and their supporters.
With the New Deal institutions and programs well entrenched, neither party could gain votes by rejecting them. The perceived geopolitical threat from the Soviet Union led prominent conservatives to favor a strong, militarily active state. It should be clear that there is a certain inherent tension in this position; "Only an active, centrally organized bureaucracy with a military-industrial complex to go along could spread freedom to the entire world in the face of an active, centrally organized bureaucracy with a military-industrial complex to go along wanting to spread communism to the entire world."
During and after the Cold War Since the cold war, even the occasional populist such as Reagan or Trump has ended up massively expanding centralized control over the economy and social life. Today, as Mikesplace correctly points out, an unprecedented amount of wealth is controlled politically and distributed out in the form of subsidies and welfare programs. Genuine support for laissez-faire economics (that isn't cushioned with exceptions for military expenditures) is practically non-existent.
Why did a communist party not take power in the US? The short answer is that their wishes were gradually implemented, so the incentive to seize power was reduced. On the same note, it is not accurate to say that the US is "capitalist". Since the beginning it has been a "mixed economy", which has steadily become more socialized with time.
It is worth pondering what is meant by a country being "communist". Does it mean brandishing certain symbols and officially espousing certain doctrines? Or is it enough to observe if its economy and political institutions are structured along lines that align with those recommended by communists? Food for thought...