Of the word "whom", Calvin Trillin, the award winning humorist, opined:
As far as I'm concerned, "whom" is a word that was invented to make everyone sound like a butler."
Actually, we like "whom", but admittedly, it can be a difficult word to use correctly.
In general, "who" refers to the subject and "whom" refers to the object; thus, in the example above from Khan Academy, the sentences: "The spy who loved me." and "The spy whom I loved." are correct, because in the first sentence "who" is refering to "The spy" - the subject of the sentence. And in the second sentence, "whom" is referring to "The spy" - the object of the sentence.
Or you could take Pulitzer Prize winning William Safire's advice whom reportedly advised:
"When "whom" is correct, recast the sentence."