$y = 2 - x$
$y = x^2 + 2x + 2$
After substituting $x = 2 - y$ into the second equation (I am aware of substituting y into the second equation), I get $y = 5, y = 2$. However, when I substitute 5 into the second equation ($y = x^2 + 2x + 2$) I get $x = 1, x = -3$ (after solving it using the quadratic formula), where $x=1$ is a wrong answer. However, if I substitute 5 into the first equation ($y = 2 - x$), I get $x=-3$, and after 2 substituted, I get $x = 0$. Why are the answers different when I substitute into the quadratic one? Can't I substitute into the quadratic one?
The blue line $y=2-x$ cuts the parabola $y=x^2+2x+2$ at $(3,-5)$ and $(0,2)$. But when you put y=5 in the second equation, you are actually solving the parabola with the green line $y=5$, which cuts the parabola at 2 points, one of which is $(-3,5)$ and the other is $(1,5)$, which causes your confusion.
This might interest you: Why can a system of quadratic and linear equation produce incorrect solutions?
App used for image: Desmos graphing calculator (just to avoid any consequences of cropping out the logo; I am not affiliated to Desmos in any form whatsoever).