No, $(\lambda x\to x)$ is a function that takes a number (or, indeed, anything whether or not it is a number) to itself. When you say $(\lambda x\to x)y$ you're applying that function to $y$ (whatever $y$ is), and the result of that is just $y$.
In $(\lambda x\to gx)$ you have a function that takes something and returns the value of $g$ applied to that something -- as you describe it, a function that takes $x$ and produces $gx$.
However, again, when you write $(\lambda x\to gx)x$ you have taken the function just described and applied it to $x$, which would produce $gx$.
The statement that $g$ and $x$ are free variables means that the expression "$(\lambda x\to gx)x$" doesn't really have a value before you decide what the value of the variables $g$ and $x$ are going to be. It's a recipe for doing something with a thing you call $g$ and a thing you call $x$, but you can't really do it before you have decided what those things are going to be.
Note, by the way, that in $(\lambda x\to gx)x$ you have two different $x$ around. If we write it $(\lambda x_1\to gx_1)x_2$, the two ones shown as $x_1$ is just a dummy variable that tells you what the function does with its argument, whereas the $x_2$ is the free variable whose value you're supposed to decide.