Derivatives irl do not follow the rules of calculus that you learn in class because they don't have to be continuous. (you could quibble that if you zoom in enough it can be regarded as continuous.. But you don't gain anything from doing that, it really does behave discontinuous)
(I suppose a rudimentary version of this is taught in intro calc. It's been a long time so I don't really remember.)
The derivative at 0 exists and is 0, because lim h-> 0 (h^2 sin(1/h))/h = lim h-> 0 (h sin(1/h)), which equals 0 because the sin function is bounded.
When x !=0, the derivative is given by the product and chain rules as 2x sin(1/x) - cos(1/x), which obviously approaches no limit as x-> 0, and so the derivative exists but is discontinuous.
Awesome stuff.