Consider
$$\exists x\exists yP(x,y) \to\exists x\exists yP(y,x).$$
Is the above statement valid? Please explain why.
I thought is is valid and that I could write $\exists x\exists yP(y,x)$ as $\exists y\exists xP(x,y)$ and if $\exists x\exists yP(x,y)$ is true then there must exist a $y$ for an $x$ too, and thus $\exists x\exists yP(y,x)$ is also true but the answer given is invalid.
Yes, of course. $\exists x\exists y P(x,y)$ means $P(a,b)$ for some $a$ and $b.$ This is an inference rule sometimes called existential instantiation. Then setting $y=a$ and $x=b$ we can infer $\exists y\exists xP(y,x)$ by existential generalization. Less formally, both of these sentences just say that the predicate $P$ is true for some input. The names of the variables used aren't relevant.