$f, x, y$ are integers. (The proposition is not true if we allow $x,y$ to be rationals. e.g. let $x = y = \frac 13$ then $f = 11$)
$f = \frac {y}{x} + \frac {x}{y} + \frac {1}{xy} \implies xyf = x^2 + y^2 + 1$
$xyf \equiv x^2 + y^2 + 1 \pmod{3}$
If $x$ or $y$ are divisible by 3 then $xyf \equiv 0 \pmod 3.$
But then, it would not be possible for $x^2 + y^2 + 1 \equiv 0 \pmod 3$
If neither $x$ nor $y$ is $0$ modulo $3$ then $x^2 + y^2 + 1 \equiv 0 \pmod 3$
In which case $f\equiv 0 \pmod 3$
A quick primer on the field of integers mod $p$
We can think of modulo $p$ as the remainder we get when we divide by $p.$
If a number is equivalent to 0 mod p then it is divisible by $p.$
Modular arithmetic preserves addition and multiplication. That is, if we add to numbers and evaluate modulo p, we can just as easily evaluate the numbers modulo p before we add them. And, if we multiply integers and evaluate mod p, we can first evaluate modulo p and then multiply. If we get a result bigger than p we can evaluate that result modulo p.
We can use this to dramatically simplify problems, as there are only p cases to check for each variable in the equations, or for this problem 3 cases.
When we look at $x^2 + y^2 + 1$ we only have to consider: $1^2 \equiv 1 \pmod 3, 2^2 \equiv 1 \pmod 3$ and $0^2 \equiv 0 \pmod 3.$ If $x,y$ are not divisible by 3 then $x^2 + y^2 + 1 \equiv 0 \pmod 3$ If x or y are divisible by 3, then $x^2 + y^2 + 1 \equiv 1,2 \pmod 3$
If p is prime, the integers mod p form a ring. That is $ab\equiv 0\pmod p \implies$ p divides a or p divides b. Toward the end of the proof, we are using this property. We have shown that $xyf = x^2 + y^2 + 1 \equiv 0 \pmod 3$ and $x,y$ are not divisible by $3$ therefore $f$ is.