Friedrich Nietzsche was a German philosopher who announced the death of God. His works questioned the basic fabric of Western morality. On the Genealogy of Morals is one such essay that looks at the origin of morals and delves deeper into the subject of their current form. It talks about guilt, punishment, good, bad, sin, revenge and conscience to name a few.
Contrary to what English philosophers were saying about the concept and judgement "Good", Nietzsche argued that Good did not originate from people showing "Goodness" to others. That is, the utility of something, here the moral "Good", does not describe its origin. The noble, powerful, high-stationed established themselves and their actions as "Good". And dictated everyone below that standard as "Bad".
Nobility grows spontaneously and on its own. It seeks its opposite only to affirm itself. Revenge is born out of an external stimulus; as long as the oppressed is denied expression of its true reaction, he will harbor resentment. For revenge, "its action is fundamentally reaction".
For origin of guilt, one must look at the relationship between a creditor and a debtor. When a debtor is unable to repay, the creditor compensates his loss by having the debtor punished. The punishment serves as a pleasure extracted in lieu of the creditor's loss. Guilt was thenceforth thrust as suffering.
To understand de-structuring of bad conscience, one must imagine man as an animal, hunting, scavenging with mode of life similar to that of a beast. Now put this beast in the cage of society. Until now, man could express his violent tendencies through his savagery, but in a civilization, he is forced to internalize them. Without a channel to express such propensities, he develops a bad conscience, filled with self-hatred, loathing and the desire to be free of the "sin".
Throughout the two essays that constitute On the Genealogy of Morals, one can find Nietzsche's disgust for the Church and its ways. He bashes priesthood and nobility while explaining various morals. Since he wrote in German, not all words have exact translations in English. Also, Nietzsche was creative with his vocabulary, so it is recommended to read a version with editorial notes.
References: Basic Writings of Nietzsche, translated by Walter Kaufmann. 2000 Modern Library Edition.