How can one integrate $\int_{-c}^{c} e^{-ax^2}\cos^2(bx) \,\mathrm{d}x$?
Write
$$\cos^2(bx)=\frac12(1+\cos(2bx))=\frac12+\frac14 e^{2b i x}+\frac14 e^{-2b i x}\tag1$$ Then
$$e^{-ax^2}\cos^2(bx) =\frac12e^{-ax^2}+ \frac14 e^{-ax^2+2b i x}+\frac14 e^{-ax^2-2b i x}\tag2$$
With appropriate substitutions, the matter reduces to integration of $\exp(-t^2)$, which yields the error function. Of course, this is what WA already did for you.
If $\int_{-c}^{c} e^{-ax^2} \, \mathrm{d}x=k$, then can we express the first integral in terms of $k$?
No, because the integral of a product is not the product of integrals... But it is true that
$$ \lim_{b\to\infty} \int_{-c}^{c} e^{-ax^2}\cos^2(bx) \,\mathrm{d}x =\frac{k}{2}\tag3$$
because the highly oscillatory terms $e^{\pm 2b i x} $ in (1) contribute little when $b$ is large. See the Riemann-Lebesgue lemma.