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.
Almost valid Zsh, 3 + 3 = 6 bytes, \$ Z = \mathbb Z^* \$
rev
This reverses the digits of the input.
cat
This outputs the input unchanged: \$ \operatorname{cat}(x) = x \$
If \$ x \$ is a palindrome, then \$ \operatorname{rev}(x) = x \$, so \$ \operatorname{rev}(\operatorname{cat}(x)) = \operatorname{cat}(\operatorname{rev}(x)) \$.
If \$ x \$ is not a palindrome, then \$ \operatorname{rev}(x) \ne x \$, so \$ \operatorname{rev}(\operatorname{cat}(x)) \ne \operatorname{cat}(\operatorname{rev}(x)) \$.
Clearly there are infinitely many palindromes and non-palindromes, so this must be valid, right?
Unfortunately, no: if the number has trailing zeroes, like \$ 130 \$, then the output is \$ 031 \$. We could just say that the I/O format is "a decimal string with optional leading zeroes", but then the input \$ 07 \$ and \$ 7 \$ would give different outputs.