Zsh, 20 bytes
\$ f(x) = \lfloor \frac x 2 \rfloor \$
<<<$[$1/2]
\$ g(x) = 2x \$
<<<$[$1*2]
For even \$ x \$, \$ f(x) = \frac x 2 \$, so \$ g(f(x)) = x \$.
But for odd \$ x \$, /2 rounds downwards, so \$ f(x) = f(x-1) \$, so \$ g(f(x)) = x - 1 \ne x \$
\$ g(x) \$ is always even, so for all \$ x \$, \$ f(g(x)) = x \$.
Therefore, \$ f(g(x)) = g(f(x)) \$ if and only if \$ x \$ is even.