HINT:
Write
$$\begin{align}
e^{-x^2/2}\cos(ax)&=\text{Re}\left(e^{-x^2/2+iax}\right)\\\\
&=e^{-a^2/2}\text{Re}\left(e^{-\frac12(x-ia)^2}\right)\tag 1
\end{align}$$
Exploit the evenness of the integrand, use $(1)$, translate the argument by enforcing the substitution $x-ia \to x$, deform the contour back to the real line exploiting Cauchy's Integral Theorem, evaluate the resulting Gaussian integral, and take the real part.
SPOILER ALERT: Scroll over the highlighted area to reveal the solution
Therefore, $$\begin{align}\int_0^\infty e^{-x^2/2}\cos(ax)\,dx&=\frac12 e^{-a^2/2} \int_{-\infty}^\infty \text{Re}\left(e^{-\frac12(x-ia)^2}\right)\,dx\\\\&=\frac12 e^{-a^2/2} \text{Re}\left(\int_{-\infty}^\infty e^{-\frac12(x-ia)^2}\,dx\right)\\\\&=\frac12 e^{-a^2/2} \text{Re}\left(\int_{-\infty-ia}^{\infty-ia} e^{-\frac12 x^2}\,dx\right)\\\\&=\frac12 e^{-a^2/2} \text{Re}\left(\int_{-\infty}^{\infty} e^{-\frac12 x^2}\,dx\right)\\\\&=\frac12 \sqrt{2\pi }e^{-a^2/2}\end{align}$$as was to be shown!