I heard the Vatican was one of the biggest enemies to Communism and I heard the Vatican looked the other way towards Hitler. I want to know if both of these things are fact or fiction.
You are correct about the Vatican and its opposition to communism, but I believe you underplay the Vatican’s position on fascism.
You may be interested in an earlier post of mine, in which I examine the Vatican and the Holocaust, specifically the question of allegations of silence and inaction on the issue.
Fascism
The most direct opposition to Nazi ideology was provided by Pius XI in his encyclical Mit Brennender Sorge. The full text can be read here. This document, released in March of 1937, was a direct challenge to Nazi ideology. It had to be smuggled into Germany, and after it was read to Catholic congregations the Gestapo attempted to seize as many copies of it as possible. Subsequently, Vatican Radio and Catholic newspapers were banned.
The first part of the encyclical deals with condemning Nazi violations of the Reichskonkordat, signed in 1933. The remainder deals with outlining the problems the Church had with Nazi ideology. Perhaps the most striking excerpt comes from section 8:
Whoever exalts race, or the people, or the State, or a particular form of State, or the depositories of power, or any other fundamental value of the human community - however necessary and honorable be their function in worldly things - whoever raises these notions above their standard value and divinizes them to an idolatrous level, distorts and perverts an order of the world planned and created by God; he is far from the true faith in God and from the concept of life which that faith upholds.
It may be useful at this point to discuss some peculiarities in encyclicals. At their most basic, they are letters from a pontiff to a particular bishop or area of the world. However, they have been leveraged by the papacy since the 1800's as a teaching tool and a way to address issues in the world. While they do discuss events going on at the time of their publication, they are not focused only on the present. Encyclicals are used to address the present, the past, and the future--often in equal measures. As such, their language is inherently biased toward generalizations over specificities. In this case, rather than merely addressing Nazism in Germany, Pius XI chose to speak about any possible governments--past, present, and future--that exhibit similar tendencies. So you will not see the term 'fascism' in Mit Brennender Sorge. Context is critical to understanding encyclicals, and without proper context they can appear to be relatively bland statements. (Basically, if you're looking for the evocative and fiery prose of Churchill, you're going to be disappointed) The nature of encyclicals is actually addressed in section 41:
We have weighed every word of this letter in the balance of truth and love. We wished neither to be an accomplice to equivocation by an untimely silence, nor by excessive severity to harden the hearts of those who live under Our pastoral responsibility; for Our pastoral love pursues them none the less for all their infidelity
Returning to the text, sections 15 and 16 praise the Old Testament, an oblique statement of support for German jews. This becomes more explicit in section 18:
The Church founded by the Redeemer is one, the same for all races and all nations. Beneath her dome, as beneath the vault of heaven, there is but one country for all nations and tongues; there is room for the development of every quality, advantage, task and vocation which God the Creator and Savior has allotted to individuals as well as to ethnical communities
Another explicit refutation of the ideology of race is present in section 11:
None but superficial minds could stumble into concepts of a national God, of a national religion; or attempt to lock within the frontiers of a single people, within the narrow limits of a single race, God, the Creator of the universe, King and Legislator of all nations before whose immensity they are "as a drop of a bucket" (Isaiah xI, 15).
The call to action by individual Catholics is in section 19, "at no moment of history, no individual, in no organization can dispense himself from the duty of loyally examining his conscience, of mercilessly purifying himself, and energetically renewing himself in spirit and in action." It is clear, sadly, that many Catholics had divided loyalty and did not heed the call to heroism in section 21. Far too many chose country over Church in this instance, and many Catholics participated in the atrocities of WWII.
Communism
This encyclical was one of three issued in March of 1937. Divini Redemptoris dealt with the Church's opposition to Communism. The Church’s problems with communism date back further, to one of the most important documents in Church history—Rerum Novarum. This 1891 encyclical forms the foundation of modern Catholic thought on social justice issues, and has been updated and commemorated on a number of occasions. The Church was concerned about the issues faced by the lower classes in the wake of industrialization, but had a very different approach to economics than did the communists. Over time, these thoughts crystalized and the result was Divini Redemptoris.
In the encyclical, the basic incompatibilities between the two ideologies are outlined. From section 3:
This all too imminent danger, Venerable Brethren, as you have already surmised, is bolshevistic and atheistic Communism, which aims at upsetting the social order and at undermining the very foundations of Christian civilization.
Then we have the outright rejection of communism in sections 12 and 14.
12: What would be the condition of a human society based on such materialistic tenets? It would be a collectivity with no other hierarchy than that of the economic system. It would have only one mission: the production of material things by means of collective labor, so that the goods of this world might be enjoyed in a paradise where each would "give according to his powers" and would "receive according to his needs." Communism recognizes in the collectivity the right, or rather, unlimited discretion, to draft individuals for the labor of the collectivity with no regard for their personal welfare; so that even violence could be legitimately exercised to dragoon the recalcitrant against their wills. In the Communistic commonwealth morality and law would be nothing but a derivation of the existing economic order, purely earthly in origin and unstable in character. In a word. the Communists claim to inaugurate a new era and a new civilization which is the result of blind evolutionary forces culminating in a humanity without God.
14: Such, Venerable Brethren, is the new gospel which bolshevistic and atheistic Communism offers the world as the glad tidings of deliverance and salvation! It is a system full of errors and sophisms. It is in opposition both to reason and to Divine Revelation. It subverts the social order, because it means the destruction of its foundations; because it ignores the true origin and purpose of the State; because it denies the rights, dignity and liberty of human personality.
Basically, the Vatican saw basic incompatibilities between the two ideologies. While there were problems with capitalism (also addressed in the encyclical, as well as in Quadragesimo Anno in 1931), the materialistic nature of communism as well as its solidly atheistic stance made it impossible for Catholics to be also communists.
Analysis
One must keep the context of the times in mind when investigating the Vatican in the 20th century. Fascism in 1937 was not reviled in the way that it is now. With the democracies appearing to be weak in the wake of the Great Depression, many saw fascism as a way forward. The possibility of communism taking over much of Europe was seen as very real, and continued through the 1940’s. Clearly, fascist movements were opposed to communism, and many saw them as a useful tool in opposing that ideology. If you feared communism more than you feared fascism, it was a reasonable position to take. Obviously, the full horrors of the fascist governments in Germany, Italy, and Spain were not as exposed in the 1930’s as they were in the 1940’s. So, in the beginning the Vatican and others did not immediately oppose fascism either in specific governments or as an ideology. As the Vatican began to have closer interactions with these entities, the problems the Church faced in fascist governments (concordat violations, fascist governments restricting Church activity, the emerging understanding of the brutality of fascist regimes, and more) became more apparent. While the Church had decades to examine its relationship with communism, it had much less time to react to fascism. Antipathy between the various fascist governments and the Vatican grew through the 1930’s, and in March of 1937 the Vatican set out its criticisms of fascism as well as its rejection of communism. While fascism was not completely rejected, the suppression of Mit Brennender Sorge by Germany, Italy, and Spain should illustrate the growing hostility between the Vatican and fascist governments.
I hope I have answered your question. As always, followup questions by OP and others are encouraged!
(multiple edits for formatting)