Using:
$\cos (w t)=\Re(\exp (i w t))$
Re[Integrate[
1/Sqrt[4 Pi d t] Exp[-L^2/(4 t d)] Exp[-t/x] Exp[I w t], {t, 0,
Infinity}]]
(*1/2 Re[E^(-(Sqrt[-I w + 1/x]/Sqrt[(d/L^2)]))/(
Sqrt[d] Sqrt[-I w + 1/x])]*)
if: Re[L^2/d] > 0 && Im[w] + Re[1/x] > 0
We can speed up computation if:
Re[Integrate[
1/Sqrt[4 Pi d t] Exp[-L^2/(4 t d)] Exp[-t/x] Exp[I w t], {t, 0,
Infinity}, Assumptions -> {d > 0, L > 0, x > 0, w > 0}]]