We have got the functional equations.
f(x) = x^2 and g(x) = x+2
So, when we have to find fog(x), we have to substitute from right to left. In general sense, we substitute first which is nearer to variable.
fog(x) = f(x+2)
= x^2+4x+4
And,
gof(x) = g(x^2)
= x^2+2