The derivative of a function doesn't need to be continuous. Your example is one counterexample. All the problems with the considered function appear at $0$, since that's where the formula $x^2\sin \frac{1}{x}$ does not work anymore.
For a start, notice that your function is continuous, since when you take $x\to 0$ you have zero multiplied by a bounded quantity ($\sin$ is bounded).
When the function is given like this, you can study the continuity in $0$ only by definition.
$\lim_{x \to 0} \frac{f(x)-f(0)}{x-0}=\lim_{x \to 0}x \sin \frac{1}{x}=0 $
therefore $f'(0)$ exists and it equals zero.
For every other $x\neq 0$ you can differentiate like usual, using the formulas
$\left( x^2\sin \frac{1}{x} \right)'=2x \sin \frac{1}{x}+x^2 \cos \frac{1}{x}\left(-\frac{1}{x^2}\right)=2x \sin\frac{1}{x}-\cos \frac{1}{x}$
Notice that this function is not continuous in $0$.
Now you have
$f'(x)=\begin{cases}0 & x=0\\ 2x \sin\frac{1}{x}-\cos \frac{1}{x} & x \neq 0\end{cases}$
a function which is not continuous.
Maybe you are asking for a criterion for differentiability of a function using a corollary of Lagrange's theorem. You can see my answer in this post for more details, but this does not apply to your case, since the limit $\lim_{x \to 0}f'(x)$ does not exist.
To answer the second part of your question, the corollary presented in the link says that if you can calculate $f'(x)$ around $x_0$ but not in $x_0$ (directly) and $\lim\limits_{x \to x_0} f'(x)$ exists and it is finite, then $f'(x_0)$ also exists and it equals the previous limit.