I'm considering $f(x) = x^2\sin(1/x)$ for $x\ne 0$, and $f(0)=0$.
MVT gives me $(f(x)-f(0))/ x = x \sin(1/x) = f'(c) = 2c \sin(1/c) - \cos(1/c)$ for some $c$ between $x$ and $0$.
Taking the limit as $x$ goes to $0$ gives me $0 = \lim_{c\to 0} \cos(1/c)$ which doesn't make sense.
What did I do wrong?


This is a classic mistake when applying the mean value theorem. Note that the $c$ obtained from the mean value theorem might be different for each $x$. You apply mean value theorem once for each single $x$, and get a (likely different) $c$ for each single $x$, so you really should write $c_x$ or $c(x)$ to express this dependency.
Now, when taking limits, you cannot treat $c$ as an independent variable without justification, since it does depend on $x$. In other words, even though $\displaystyle\lim_{x\to 0} c(x)=0$, we still could have $$ \lim_{x\to 0} \cos(1/c(x)) \neq \lim_{c\to 0} \cos(1/c). $$ An example is given in my comment, i.e. $c(x)=1/(\pi/2+\lfloor x^{-1} \rfloor\pi)$.