Why does this way of solving inequalities work?
As written your teacher's proof is incorrect. The correct way to write your teacher's proof would be to write $$a^2+b^2 \geq 2ab\iff a^2+b^2-2ab \geq 0\iff(a-b)^2\geq 0$$ where each of the statements are equivalent to each other. The final statement is true, hence so is the first. It is much cleaner to write the proof in the reverse direction i.e. $$(a-b)^2\geq 0\implies a^2+b^2-2ab \geq 0\implies a^2+b^2 \geq 2ab$$
Your teacher is incorrect. In order to prove something is true, you do not assume it first. Here is a correct, logical way.
Let $a$ and $b$ be real numbers. Then, $(a-b)^{2}\geq 0$. Hence, $a^{2}-2ab+b^{2}\geq 0$, and thus, $a^{2}+b^{2}\geq 2ab$.
If the teacher worded it exactly as you have, then he is absolutely wrong.
However, there's a proof technique that follows a similar structure and is correct, which might have been what the teacher was going for. I'm talking about having the inference direction opposite to the writing direction.
Usually a proof starts with something that is true, makes a deduction from it, and continues until you reach your result: $a \Rightarrow b \Rightarrow c \Rightarrow d$.
Instead, you can start with what you want to prove, but instead of showing what follows from it, show what it follows from: $d \Leftarrow c \Leftarrow b \Leftarrow a$. If you end up with something true, then your original claim is true as well.
This is what your teacher was trying to do: $a^2+b^2\ge 2ab \Leftarrow a^2+b^2-2ab \ge 0 \Leftarrow (a-b)^2 \ge 0$. The last statement is true, so this completes the proof.
Some of the confusion might arise from the fact that in this case, all these inferences are reversible - it's true that $a^2+b^2\ge 2ab \Leftarrow a^2+b^2-2ab \ge 0$, but it's also true that $a^2+b^2\ge 2ab \Rightarrow a^2+b^2-2ab \ge 0$. But it's only the first of these inferences that is relevant for the proof. And of course, in other proofs you might use inferences which are not reversible.
This technique is logically the same as the usual forward method, but useful when you don't know what premise to start from; instead, you take what you want to prove, and figure out what you need in order for it to be true.