We use the pronoun 'he' to replace a name in a particular sentence.
For instance, instead of saying <em>"John has a dog"</em>, we could say <em>"He has a dog"</em>
We use 'him' when we replace a name in a sentence which is used as an object.
We could either say <em>"The dog belongs to John"</em>, or <em>"The dog belongs to him"</em>. (Note that in this case, the dog is the subject, and John (he) is the object)
It is now easy to understand the difference between 'who' and 'whom': the difference between these two pronouns is the same as the difference between 'he' and 'him'. 'Who' replaces a subject - a person that performs the action, while 'whom' replaces an object.
For instance, we could ask:<em> "</em><em>Who</em><em> has a dog?"</em>, but we would say<em> "I am not sure </em><em>whom</em><em> this dog belongs to."</em>