Answer
$$-x^{2} \cos x +2x \sin x+2 \cos x+C$$
Work Step by Step
Given
$$\int x^{2} \sin x d x$$
Use the rule
$$\int x^{n} \sin x d x=-x^{n} \cos x+n \int x^{n-1} \cos x d x$$
Here $n=2$, then
\begin{aligned}
\int x^{2} \sin x d x&=-x^{2} \cos x+2\int x \cos x d x
\end{aligned}
To evaluate $\displaystyle\int x \cos x d x$, use
$$\int x^{n} \cos x d x=x^{n} \sin x-n \int x^{n-1} \sin x d x$$
Here $n=1$ and
\begin{aligned} \int x\cos x d x&=x \sin x- \int \sin x d x\\
&=x \sin x+ \cos x+C \end{aligned}
It follows that
\begin{aligned}
\int x^{2} \sin x d x&=-x^{2} \cos x+2\int x \cos x d x\\
&=-x^{2} \cos x +2x \sin x+2 \cos x+C
\end{aligned}