Answer
$(f \circ g)(x) = \cos^2 x -1$; its domain is all of real numbers, $\mathbb R$
$(g \circ f)(x) = \cos (x^2 -1) $ ; its domain is all of real numbers, $\mathbb R$
These two composite functions are not equal.
Work Step by Step
To obtain $f \circ g$, we have $$\begin{align} (f \circ g)(x) & =f(g(x))
\\ & =f(\cos x) \\ & =(\cos x)^2-1 \\ &=\cos^2 x-1 \end{align}$$ To obtain $g \circ f$, we have $$\begin{align} (g \circ f)(x) &=g(f(x)) \\ & = g(x^2-1) \\ & =\cos (x^2 -1) \end{align}$$
It can be easily seen that the domains of the above composite functions are all real numbers , $\mathbb R$.
To find that these two composite functions are not equal, one can compute the value of the functions for $x=0, \, 0 \neq \cos (-1) $, so $ f \circ g \neq g \circ f$.