Alright, let's say we have f(x) = x2 - 2x - 7 and you are asked for f(3).
f(3) = 32 - 2(3) - 7 = 9 - 6 - 7 = -4
Now, let's say g(x) = x3.
f(g(x)) = (x3)2 - 2(x3) - 7 = x6 - 2x3 - 7
g(f(x)) = (x2 - 2x - 7)3 = (x2 - 2x - 7)(x2 - 2x - 7)(x2 - 2x - 7) = ...