Use the product rule, since x² and sin(x) are two functions multiplied together.
Let u = x² and v = sin(x). Then u' = 2x and v' = cos(x). The product rule says (uv)' = u'v + uv', so:
d/dx [x² sin(x)] = (2x)(sin x) + (x²)(cos x)
That simplifies to:
d/dx [x² sin x] = 2x sin x + x² cos x
A quick check: at x = π, the function x² sin x equals 0, and its slope there should be π²·cos π = −π² ≈ −9.87. The formula gives 2π·sin π + π²·cos π = −π², which matches. The product rule is one of the standard results in any first-year calculus text, such as Stewart's Calculus, so you can find worked versions there if you want more practice.