This has been sitting in my inbox for aaaaaages, because I want to do it justice! It's actually a big facet of my research project that I'm going to go into much, much, much more depth on, but here's the short(er) summary:
The foundational text of the Hays Code was written by two Catholics: a Jesuit priest named Father Daniel Lord, and a man named Martin Quigley, who was the editor of the Motion Picture Herald. They grounded their guidelines in Catholic morality and values, based on the idea that art could be a vehicle for evil by negatively influencing the actions of those who view it.
The original list of guidelines written by Lord and Quigley was adapted into the Production Code, popularly known as the "Hays Code" after William Hays, the president of the Production Code Administration that enforced it. As president of the PCA, William Hays appointed a staunch Catholic man called Joseph Breen to enforce the code. Breen enforced it aggressively, confiscating the original reels of films he deemed inappropriate and against the Code. Many lost films from this era are only "lost" because Joseph Breen personally had them destroyed. Some were rediscovered later, but many were completely purged from existence.
When Breen died in 1965, Variety magazine wrote, "More than any single individual, he shaped the moral stature of the American moral picture." He was a very, very big deal, and was directly responsible for censoring more films than I could even begin to list here.
In 1937, Olga J. Martin, Joseph Breen’s secretary, said, “To an impoverished country which had become religious and serious-minded, the sex attitudes of the post-war period became grotesquely unreal and antedated. The public at large wanted to forget its own derelictions of the ‘gay twenties.' The stage was set for the moral crusade.”
In 1936, once the Code was being fully enforced on filmmakers by Joseph Breen, a letter was issued by the office of Pope Pius XI that praised Breen's work, and encouraged all good Catholics to support film censorship.
The letter read in part, "From time to time, the Bishops will do well to recall to the motion picture industry that, amid the cares of their pastoral ministry, they are under obligation to interest themselves in every form of decent and healthy recreation because they are responsible before God for the moral welfare of their people even during their time of leisure. Their sacred calling constrains them to proclaim clearly and openly that unhealthy and impure entertainment destroys the moral fibre of a nation. They will likewise remind the motion picture industry that the demands which they make regard not only the Catholics but all who patronize the cinema."
Basically, this letter was a reminder from the Papal authority that bishops and priests are supposed to stop people from engaging with "lewd" or "obscene" art. That meant supporting things like the Hays Code.
So, to summarize: the original text of the Hays Code was written by two Catholics, including a priest. The biggest and most aggressive censor under the Code was a Catholic man, who had the full support and approval of the Pope at the time. Good Catholics were called en-masse to support the Hays Code, because it was intentionally written to line up with Catholic teachings.
There's a lot more to say on the subject, and if you're interested in reading more on your own, I recommend the book "Pre-Code Hollywood: Sex, Immorality, and Insurrection in American Cinema, 1930-1934," by Thomas Doherty. There are plenty other sources I can recommend on request, but that's a solid place to start.
(And if I can toot my own horn, I'm intending to do a video lecture series all about American film censorship and the Hays Code. Pledging to my Patreon helps keep me fed and housed while I do all this damn research.)