Define two systems of equations to be equivalent if they have precisely the same sets of solutions. Abstracting, "solving a system of equations" is the process of successively replacing a given system by equivalent systems until one reaches a "tautological" system whose solutions can be read off by inspection.
For example, the system
$$
\left.
\begin{aligned}
y &= 2x + 3 \\
y &= x^{2} + 3x + 1
\end{aligned}
\right\}
\tag{1}
$$
is equivalent, by subtracting the first equation from the second, to the system
$$
\left.
\begin{aligned}
y &= 2x + 3 \\
0 &= x^{2} + x - 2
\end{aligned}
\right\}
\tag{2}
$$
in which $y$ has been eliminated from the second equation. You solved the second equation using the quadratic formula, obtaining
$$
\left.
\begin{aligned}
y &= 2x + 3 \\
x &= -2\quad\text{or}\quad 1
\end{aligned}
\right\}
\tag{3}
$$
then implicitly used the first equation to deduce the corresponding value(s) of $y$.
"Why this works" should be apparent. From this perspective, it should be clear that the reasoning
Equating the curve and the straight line means they share a single similar value of $y$ while they clearly share two.
would point to a logical gap only if the equation $y = y$ had a unique solution. But the opposite is true: $y = y$ is a tautology; it has no non-solutions.
In general, any "reversible operation" on a system of equations yields an equivalent system. The following operations (non-exhaustive list!) are reversible is this sense:
Adding a (constant) multiple of one equation to another equation.
Multiplying an equation by a non-zero constant, or by a non-vanishing expression.
Exchanging two equations.
Replacing an equation $a = b$ with $f(a) = f(b)$ for some injective function $f$. (For equations involving real variables, this includes cubing or exponentiating both sides, squaring both sides when both sides are known to be non-negative, and so forth.)
If $f$ and $g$ are functions, replacing $f(y) = g(y)$ with $f(\phi(x)) = g(\phi(x))$ for some injective function $\phi$.
Compare the first three with the Gaussian elimination algorithm for systems of linear equations in several variables.