The correct option is C In spite of having many faults, he was a good man at heart.
A preposition is a word which shows the relation of a noun or pronoun to another word in a sentence. On the other hand, a gerund is a verb which acts like a noun and a noun refers to the word which can be a name of any person, animal or thing.
Here, option C is correct. In order to combine sentences preposition should be followed by noun or gerund. In this sentence, 'of' is a preposition followed by 'having' a gerund, thereby retaining the true meaning of the sentence.
Option A has conjunction in it. So, it is incorrect.
Option B is irrelevant in its meaning. So, it is incorrect.
Option D is a negative sentence and meet the needs of question. So, it is incorrect.