This is straightforward if we are permitted to use homology or fundamental groups and if $f$ is assumed continuous. I will proceed using the fundamental group.
Suppose we had such an $f$. Then consider the induced map $\pi(f) : \mathbb{Z}^2 \to \mathbb{Z}$. I am abusing notation a bit by writing the fundamental groups as $\mathbb{Z}^2$ and $\mathbb{Z}$, but it’s not a big deal.
The constraint $f(x, x) = x$ is tantamount to saying $f \circ \Delta_ \mathbb{S} = 1_\mathbb{S}$, where $\Delta_\mathbb{S} : \mathbb{S} \to \mathbb{S} \times \mathbb{S}$ is the diagonal map. Therefore, we have $\pi(f) \circ \pi_{\Delta_\mathbb{S}} = 1_\mathbb{Z}$. Now since $\pi$ preserves products, it preserves the diagonal map. So we see that $\pi(f) \circ \Delta_\mathbb{Z} = 1_\mathbb{Z}$. That is, we have $\pi(f)(1, 1) = 1$.
The switching clause $f(x, y) = f(y, x)$ is equivalent to saying $f \circ s_\mathbb{S} = f$, where $s_\mathbb{S} : \mathbb{S} \times \mathbb{S} \to \mathbb{S} \times \mathbb{S}$ is the swapping map. Therefore, we have $\pi(f) \circ \pi(s_\mathbb{S}) = \pi(f)$. Since $\pi$ preserves products, it preserves the swapping map. So we have $\pi(f) \circ s_\mathbb{Z} = \pi_f$. That is, $\pi(f)(1, 0) = \pi(f)(0, 1)$.
Now we see that $\pi(f)(1, 1) = \pi(f)(1, 0) + \pi(f)(0, 1) = 2 \pi(f)(1, 0) = 1$. But $1$ is not divisible by $2$. This is a contradiction. $\square$
If we drop the continuity assumption, we can find such an $f$. Pick some point $p \in \mathbb{S}$, and consider the function
$f(x, y) = \begin{cases}
x & x = y \\
p & otherwise
\end{cases}$