“Whom” is a polarising word. Some people think it sounds unbearably stuffy and/or is headed for extinction. Personally, I like to whom it up wherever possible. At the very least, if you’re doing any kind of formal writing, you should know the difference between “who” and “whom”.
Subjects and objects
The “whom” rule, like many others, is based on the distinction between subjects and objects. In a sentence, the subject is the thing doing the action, the verb is the action itself, the direct object is the thing the action is being done to, and the indirect object is the thing that “gets” the direct object:
Record execs [subject] once gave [verb] a horse [direct object] to Lady Gaga [indirect object].*
Note that every complete sentence has, at the very least, one subject and one verb. There might be no object at all, or there might be multiple subjects and objects.
“Who” or “whom”?
“Who” and “whom” are both pronouns – words that can be used in place of nouns. The difference is that “who” is the subject pronoun and “whom” is the object pronoun. In other words, if the pronoun represents the subject of the sentence, use “who”:
Who gave a horse to Lady Gaga?
The record execs, who gave a horse to Lady Gaga, were generous.
If it represents the object of the sentence (whether direct or indirect), use “whom”:
To whom did the record execs give a horse?
Lady Gaga, to whom record execs gave a horse, was thrilled.
So far, we’ve looked at sentences written in the active voice: Record execs once gave a horse to Lady Gaga. But we could also rephrase the same idea in the passive voice: Lady Gaga was once given a horse by record execs. Here, Lady Gaga is the subject, even though she is ostensibly the receiver of the action. This might seem to contradict what I said earlier (“the subject is the thing doing the action”), but hear me out. In the sentence Lady Gaga was once given a horse by record execs, the verb isn’t actually to give (active form); it’s to be given (passive form). If you think about it that way, it makes sense. The subject, Lady Gaga, is doing the action – not of giving the horse but of being given the horse.
Here’s how we would replace the subject of that passive sentence with a pronoun:
Who was given a horse by record execs?
Lady Gaga, who was given a horse by record execs, was thrilled.
And here’s how we would replace the object with a pronoun:
By whom was Lady Gaga given a horse?
The record execs, by whom Lady Gaga was given a horse, were generous.
In a nutshell
“Who” is a subject pronoun – it stands in for the sentence’s subject (the thing doing the action). “Whom” is an object pronoun – it stands in for the sentence’s direct object (the thing the action is done to) or indirect object (the thing that receives the direct object).
Note that the passive voice can cause confusion. In the (more common) active voice, the action is doing x, but in the passive voice, the action is having x done to you.