I don't know what "Mathway" is, but whatever it's doing, it's hallucinating, because you are absolutely correct. If $u = \sin x$, then $du = \cos x \, dx$, which does not work: $$\int \frac{\sin^4 x}{\cos x} \, dx = \int \frac{u^4}{\cos^2 x} \, du.$$ The $\cos x$ in the denominator does not cancel out.
Another way to see that the claimed solution cannot be correct is to simply differentiate the answer:
$$\frac{d}{dx}\left[\frac{1}{5} \sin^5 x \right] = \sin^4 x \cos x,$$
and this is not equivalent to the given integrand.
A correct method of solution would be to write
$$\frac{\sin^4 x}{\cos x} = \frac{\sin^4 x \cos x}{\cos^2 x} = \frac{\sin^4 x \cos x}{1 - \sin^2 x},$$
and now let $$u = \sin x, \quad du = \cos x \, dx,$$ to obtain
$$I = \int \frac{\sin^4 x}{\cos x} \, dx = \int \frac{u^4}{1-u^2} \, du.$$ Now perform long division and partial fraction decomposition:
$$\frac{u^4}{1-u^2} = -u^2 - 1 + \frac{1}{1-u^2} = -u^2 - 1 + \frac{1}{2(1-u)} + \frac{1}{2(1+u)},$$
so
$$\begin{align}
I &= \int -u^2 - 1 \, du + \frac{1}{2}\int \frac{1}{1-u} + \frac{1}{1+u} \, du \\
&= -\frac{u^3}{3} - u + \frac{1}{2} \left( \log|1+u| - \log|1-u| \right) + C \\
&= -\frac{\sin^3 x}{3} - \sin x + \frac{1}{2} \log \left|\frac{1+\sin x}{1-\sin x}\right| + C.
\end{align}$$
Differentiation of this expression will confirm its derivative is equal to the given integrand.