Benedict Anderson in his seminal book Under Three Flags (reissued as The Age of Globalization: Anarchists and the Anticolonial Imagination) wrote that "anarchism, in its characteristically variegated forms, was the dominant element in the self-consciously internationalist radical Left" from the death of Karl Marx and persisted up perhaps the interwar period.
But why did anarchism decline in relation to Marxism? In their cross-country comparative historical study of anarchist movements, Williams & Lee suggest that:
After the war and the Bolshevik Revolution, anarchism went into a period of demobilization and decline as Communism gained increased legitimacy amongst the Left as a revolutionary ideology that was perceived to be succeeding in the USSR.
Basically, the 1917 Russian Revolution happened, of which the Bolshevik coup was an episode. After the Bolsheviks took power, Marxism suddenly gained a lot of new found legitimacy. Even in Russia itself, anarchists defected to Bolshevik-style communist movements. In addition to legitimacy, Williams & Lee noted that Bolshevik-style parties out-organized and out-competed reformist and anarchist rivals.
The Soviet Union also actively exported Bolshevik-style and later Soviet-style communism through its international organs of the Comintern and the Profintern. Anarchist and other forms of socialism simply did not have the resources of a state apparatus to compete with Soviet-style communism.
EDIT: Returning to Anderson's book, we see the subsumption of socialists into the Marxist movement. Isabelo de los Reyes brought anarchist-inflected socialism to the Philippines in the 1910s, and anarchist ideas was quite popular, but many of these militants were later subsumed into the old Communist Party of the Philippines (PKP-1930) by the time World War 2 came. This example is a microcosm of what happened to anarchism and non-Marxist socialisms in a global scale where many organizations were basically subsumed into the Marxist movement.
tl;dr: The Russian Revolution happened, Marxism became legitimate, USSR exported its ideology, anarchists and others were out-organized.
Sources:
PS, this is my first r/AskHistorians answer, hope it's alright!