I just learnt about integration by substitution and do not understand why parts of the integration cancel out.
For example
$$\int\cos x\sqrt{1+\sin x} dx$$
where $u = 1+\sin x$. Therefore we integrate $$\int(u-1)u^3 du$$
as $$\begin{split} u &= 1+\sin x\\ \sin x &= u-1\\ dx&= \frac{du}{\cos x}\\ \end{split}$$
Why is it that when we put this together as follows
$$\int (\cos x)(u-1)u^3 \frac{du}{\cos x}$$
the $\cos x$ and $\frac{du}{\cos x}$ cancel out.
What does $\frac{du}{\cos x}$ actually mean, that may help me understand?
We are not multiplying the integral are we $(\int (\cos x)(u-1)u^3\frac{du}{\cos x})$ - so that is why is cancels out.
When considering this integral, you have the correct $u$ for the substitution; however, you are attempting a u-sub-back-sub, which isn't a technique required for this problem.
If you let $u=1+\sin(x)$, then you can think of the derivative as $\displaystyle \frac{du}{dx}=\cos(x)$, which we can, in turn, write as $du=\cos(x)dx$. This is technically an abuse of the differential notation; however, it is an excellent visual and tracks.
So, with that choice of $u$, you can rewrite the integral as
$$ \int\sqrt{1+\sin(x)} \cos(x)dx, \text{ move the cosine to the end by commutativity of multiplication.}$$
$$ \stackrel{u-sub}{=}\int\sqrt{u}\,du, \text{the cos(x) dx term becomes du entirely.} $$
From there, the standard power rule for integration is applied, and substituting your original $u$ back into the resulting antiderivative gives the correct result.