In general, for any sequence of functions $g_n$ and function $g$ we have \begin{align} \lim\limits_{n\to\infty}\int_0^1 g_n(x)dx=\int_0^1 g(x)dx &\iff \lim\limits_{n\to\infty}\int_0^1 (g(x)-g_n(x))dx=0 \end{align} so it suffices that $g_n\to g$ in $L^1$.
In your case, if we assume that $f$ is continuous we can let $g_n(x)=f(x^n)$ and note that $g_n\to f(0)$ in $L^1$. To see this, let $M$ be an upper bound for $|f|$ on $[0,1]$ and take any $\epsilon>0$. Then we have some $\delta>0$ such that $0\leq x<\delta\implies |f(x)-f(0)|<\epsilon/2$, and if we choose $N$ large enough that $(1-\epsilon/2M)^N<\delta$ then for $n\geq N$ we have $\begin{align} \|g_n-f(0)\|_1 &= \int_0^1|f(x^n)-f(0)|dx\\ &\leq\int_0^{1-\epsilon/2M}|f(x^n)-f(0)|dx+\int_{1-\epsilon/2M}^{1}Mdx\\ &<\int_0^{1-\epsilon/2M}\epsilon/2 dx+\epsilon/2<\epsilon. \end{align}$ Thus for any continuous $f$, you can move the limit inside the integral when calculating $\lim\limits_{n\to\infty}\int_0^1f(x^n)dx$.
However, you certainly can't do that in the second case for just any continuous $f$, because $\lim\limits_{n\to\infty}{f(\cos nx)}$ may not exist in the $L^1$ sense. For example, if $f$ is the identity function then the sequence of functions $f(\cos nx)=\cos nx$ is not even Cauchy, as $\begin{align} \|\cos nx-\cos 2nx\|_1 &=\int_0^1|\cos nx-\cos 2nx|dx\\ &\geq \left\lfloor\frac{n}{\pi}\right\rfloor \int_0^{\pi/n}|\cos nx-\cos 2nx|dx\\ &\geq \left\lfloor\frac{n}{\pi}\right\rfloor \int_{\pi/2n}^{\pi/n}|\cos 2nx|dx\\ &\geq \left\lfloor\frac{n}{\pi}\right\rfloor \frac{1}{2n}\int_{\pi}^{2\pi}|\cos x|dx\\ &\geq \left\lfloor\frac{n}{\pi}\right\rfloor \frac{1}{n}\to\frac{1}{\pi} \end{align}$ and so it cannot converge.