The equality is not true (or rather, is not defined) for numbers that are not integers. And since differentiation is defined only for continuous functions -which the one on the LHS is not- it can't be applied here.

Another explanation: x^2 might be a notation for a function x^2. But you use it as a value (x^2=x | x=1). Then you mix both notations, but you may not differentiate a value.