Before delving into the topic, let's be very clear about one thing: anarchism in most forms is communism, and vice-versa. There was not really a distinction when the socialist movement was born. Many anarchists consider themselves "anarcho-communists", and many marxists are in fact libertarian and don't defend a "dictatorship of the proletariat". There is not really an opposition between anarchists and communists, but there is a strong historical opposition between free-thinkers and a marxist-leninist vanguard eliminating everyone who disagrees with it including many marxists. I'll assume in the rest of this comment that's what you meant with "relationship between anarchism and communism".
From an anarchist perspective, i can attest to books others have recommended. Classic anarchist books give very good historical examples and arguments against the tyranny of a well-meaning vanguard ; i was lately reading Bakunin making that very argument about a scientist-run government, which i think is quite relevant today with Andreas Malm arguing for what we could call a green dictatorship of the proletariat.
More historically, [Bloodstained: one hundred years of leninist counterrevolution](Bloodstained: One Hundred Years of Leninist Counterrevolution) was a good read. So were some books about the Spanish revolution, but i don't remember the names (except Homage to Catalonia, which someone mentioned). Emma Goldman, in Trotsky protests too much (1938) made a powerful historical account of how Trotsky and Lenin rewrote history after massacring the Kronstadt soviet, and i remember reading some french translation of Volin, a great revolutionary from the russian/ukrainian revolution (but i don't remember which text precisely).
For a case where "anarchism" and "communism" work fine together, you can read about the zapatistas. I personally would say there's two interesting features making it work:
- the zapatista movement refuses identification with marxism or anarchism, saying their political orientation has much deeper roots, from much before the europeans divided themselves along those lines
- the zapatistas have a strong separation of powers: the militias (which tend to be more marxist and hierarchic) don't have any political powers because they have the military power, and leave 100% of the political power to the communes (which tend to be more anti-authoritarian farmers)
All in all, the zapatistas have elements of authoritarian culture (especially in the people's army, where discipline and security management is important) and anti-authoritarian culture as they have no State, police or prisons as we know them. Unfortunately, apart from oral history recounted by comrades, i don't know of good sources for these specific questions/divisions/perspectives.