"Whom" is mainly used in written English; in spoken English its use is avoided by phrasing the idea in a different way, or by using "who" instead.
It is used as the OBJECT of a verb or preposition.
"Who saw Mary?" "Who" acts as a pronoun, the subject of the sentence, "Mary" being the object.
"Whom did Mary see?" Now Mary is the subject (the one doing the seeing) and the person in question is the object (the person being seen).
It can be used as a relative too:
"He is the person whom Mary saw."
I hope this helps.
- For Teachers