Is integration by substitution always a reverse of the chain rule? To integrate $\int x^3\sin(x^2+1)dx$, I took the following approach:
\begin{align*}
\begin{split}
\int x^3\sin(x^2+1)dx&=\int x^3\sin(u)\cdot\frac{1}{2x}du\\
&=\frac{1}{2}\int x^2\sin(u)du\\
&=\frac{1}{2}\int(u-1)\sin(u)du\\
&=\frac{1}{2}\int u\sin(u)-\sin(u)du\\
&=\frac{1}{2}\left(-u\cos(u)-\int -\cos(u)\cdot1du-\int\sin(u)(du)\right)+c\\
&=\frac{1}{2}\left(-u\cos(u)+\sin(u)+\cos(u)\right)+c\\
&=\frac{1}{2}\left((1-u)\cos(u)+\sin(u)\right)+c\\
&=\frac{1}{2}\left((1-(x^2+1))\cos(x^2+1)+\sin(x^2+1)\right)+c\\
&=\frac{1}{2}\left(\sin(x^2+1)-x^2\cos(x^2+1)\right)+c
\end{split}
\begin{split}
u&=x^2+1\\
\frac{du}{dx}&=2x\\
\frac{dx}{du}&=\frac{1}{2x}\\
dx&=\frac{1}{2x}du\\
\\
u&=x^2+1\\
x^2&=u-1
\end{split}
\end{align*}
When integration by substitution was first introduced to me, I was told that it was the inverse of the chain rule, and that it was used in cases where you were integrating a result from the chain rule i.e. a result in the form $g'(x)f'(g(x))$. Clearly, $x^3\sin(x^2+1)$ is not in this form, so it seems that I have used integration by substitution in a case where it is not the reverse of the chain rule.
My question is:
Have I got confused about this, and is there another way of looking at this where it becomes clear that integration by substitution is, in fact, reversing the chain rule in this problem? If I am correct, what is a better explanation of when integration by substitution can be used to solve an integral?
(Note: I suppose one way you could look at it is that $x^3\sin(x^2+1)=x^2\cdot x\sin(x^2+1)$, and that you're partially reversing the chain rule for the $x\sin(x^2+1)$ bit, but you then have to use integration by parts, as the chain rule bit is being multiplied by $x^2$.)

The integrand is
\begin{align}
x^3 \sin(x^2+1) &= \frac{x^2}{2} \sin(x^2+1)(2x)\\
&= \frac{(x^2 +1 - 1)}{2} \sin(x^2+1) (2x) \\
&= f(x^2+1) (2x)
\end{align}
where $f$ is the function defined by
$$
f(u) = \frac{(u-1)}{2} \sin(u).
$$
If $F$ is an antiderivative of $f$, then $F(x^2+1)$ is an antiderivative of the integrand. (Here we are using the chain rule in reverse.)
So, evaluating this integral has been reduced to the problem of finding an antiderivative of $f$.
