You’re trying to treat the chain rule as a mechanical manipulation of symbols instead of understanding what it actually says. It says that when you differentiate a composite function, say $g\big(f(x)\big)$, you first take the derivative of $g$ as if $f(x)$ were the independent variable, and then you multiply by $f\,'(x)$.
Here you have $h(x)=\cos(a^8+x^8)$, and you want $h'(x)$. First pretend that what’s inside the cosine is a single variable; call it $u$, if you like so that $u=a^8+x^8$ and $h(x)=\cos u$. Now differentiate with respect to $u$ to get $-\sin u$. But you weren’t really differentiating with respect to $u$: you were differentiating with respect to $x$. The chain rule says that in order to compensate for this distinction, you must now multiply by $\frac{du}{dx}$. Since $a^8$ is a constant, its derivative (with respect to anything!) is $0$, and therefore $\frac{du}{dx}=8x^7$. The chain rule now tells you that $$h'(x)=\Big(-\sin(a^8+x^8)\Big)\Big(8x^7\Big)=-8x^7\sin(a^8+x^8)\;.$$
\cos
and\sin
. $\endgroup$