More detail, same problem...
I'm having the same issue. I've checked all the settings and followed steps given by Google. Even deleted the account in Mail.app and recreated it following Googles steps.
I found an articles saying to make sure passwords are set in the Mail.app Account tab prefs, and one even walked through blowing away keychains. All have not helped. FWIW, In Tiger running Mail.app 2.x it works fine, but Mail.app 3.x under Leopard, no go. I have other accounts, like .Mac, and other SMTP unix accounts and there is no problem.
I have heard that if you have a iPhone or iTouch accessing your mail it will cause issues. I don't see how this is even plausible but will give it a try.
More detail of the problem:
First launch of Mail.app in Leopard (PPC or Intel is the same) passwords or "lost" or "missing". Go into Mail.app's prefs --> Accounts tab and put password in outbound and inbound password fields. Make sure everything is saved by clicking on General tab. Close the prefs window. Send and receive mail just fine until you quit Mail.app. Launch Mail.app again passwords are "lost" or "missing" again in the Mail.app prefs-->Account tab fields. Mail does not send and receive until you save password again. Check the keychain shows passwords, but their are multi versions of the same keychain. Could this be the root problem? Is Mail.app generating a new keychain every launch? Is it that Mail.app can't read the keychains or the password value is not understood by Gmail due to some kind of encryption?
Just asking. Maybe someone knows. But problem does not exists with SMTP unix mail or .Mac.