The Bayes' Theorem formula is:
$$P(x|y)=\frac{P(x,y)}{P(y)}=\frac{P(x)P(y|x)}{\sum_{x^{'}}P(x^{'})P(y|x^{'})}$$
In this part, $P(x|y)=\frac{P(x,y)}{P(y)}$, we don't change the $x$ and $y$ order ($P(x|y)$ has the same order as $P(x,y)$), but in the last part $P(x)P(y|x)$ we change it.
Could you please explain me why?
There is no "order", $p(x,y)$ and $p(y,x)$ are the same thing (in the sense that event $A \cap B$ is the same as event $B \cap A$).
Now, from the defition of conditional probability the joint probability can be expressed in two ways
$$p(x , y ) = p( x | y) p(y) = p (y | x ) p(x)$$
Takin the second equality, you can express one conditional probability in terms of the other (which is the point) :
$$ p( x | y) = \frac{p (y | x ) p(x)}{p(y)}$$