Mathematica is based on pattern matching, so when you wrote
y''[x] = x^2 * y[x]
initially, mathematica saw y''[x] as a "symbol/variable name" with the value on the left side assigned to it. Then you corrected it to the following
y''[x] == x^2 * y[x]
which at this point is equivalent to
x^2 * y[x] == x^2 * y[x]
which is true. Hence, mathematica gave you the corrrect result of True. When you closed mathematica and re-opened it, you killed the kernel and all definitions. Then you re-ran the code with everything correct from the beginning, and mathematica solved the differential equation.
Next time, you can just go to
Evaluation > Quit Kernel > Local
to achieve the same effect. No reason to restart the whole program just because of one little mistake.
Hope that clears things up,