I'm not sure what would cause the phenomena you're describing; could you show us the full definition of g that you're using?
Re: your side note. I understand your point, but unfortunately we have to consider how the evaluation proceeds in order to get to a solution. You're correct that function application is not exactly the same as substitution, not in Maple and certainly not mathematically, but it's pretty close to what the Maple kernel does when a function call is evaluated. And if we want to use a computer to do math for us, there's not too much we can change about that. What we can change is which value is substituted in and what that value is substituted into.
If you define f := a -> int(a * x, x = 0 .. 1) then int is not yet called - the call to int is just recorded verbatim in f. Later, if you evaluate f(x), a already has the value x, so int receives the two arguments x^2 and x = 0 .. 1.
What you seem to have in mind is to first evaluate the integral and then evaluate the result at a = x. That process would be easy to do for simple expressions using unapply, but less so for more complicated situations where you want to do the definition recursively. So let's try to get absolutely clear what you want to do first.
Finally about your last question: making x a local in g ensures that there is nothing inside Maple that depends on that particular x, so in this case, once int gets called, its first argument is the product of the local x created for that particular invocation of g and something which cannot contain that x (unless you do your best to break it). x cannot be a local to int: you are passing it into int yourself, whereas local variables are created by Maple at invocation time and are available only from that point onwards.
Hope that helps,