Are you able to access your Gmail messages via web by logging in form here?
If you can access your Gmail via web, that basically means you have correct username and password. That's a good starting point.
How do you access your Gmail on iPhone? Using the built-in Mail app of iOS, or some other mail apps such as Gmail app from Google?
It sounds like you are using POP protocol to access inbound email rather the IMAP which is more suitable for your scenario of synchronizing both inbound and outbound emails on computer and phones.
Please double check your computer and phone's mail settings, and let me know if you are using POP protocol at the moment?