Malicious software can be very good at impersonating legitimate messages from the operating system, browser, mail program and other applications - and despite some protections, Macs are not invulnerable. If you previously set up application-specific passwords, you may have to update the Mail program with that app password. If you have recently changed your Gmail password through a web browser and did not update the Mac’s Mail program, you may also see alert boxes asking for the password.
(This would also be a good time to update and change your Google password: After you log into Gmail, go to for the password settings, and to configure two-step verification.)
If you are concerned about your Mac’s security, log into your Gmail account on another computer or device to make sure your password still works.