This is the boy who are invited to the party by Tom.
=who=relative pronoun in defining the object=boy;
Tom is used as the subject.
Who is that person=boy.
Hence neither pronoun''s meaning is "Tom".
Then he* met Tom, who invited him* to a party. (然後他(he*)遇到了湯姆(Tom)，而湯姆(who)邀請他(him*)參加一個派對。)
# who：[非限制性的用法；通常前有逗號] 而那個人；但那個人《#正式的用法；不能省略 who 》。
例句：I sent it to Jones, who passed it on to Smith. (我把它交給瓊斯，而瓊斯又轉送給史密斯了。)