Gmail is IMAP by default, so deleting the emails on your Mac only deletes them on the Mac, not from the email server. Go to GMail and change the setting (meatball > Settings > Forwarding and POP/IMAP to enable POP, and to disable IMAP. (IMAP is normally used when you want to access the same email in more than one device and, if you delete it from that device, it doesn't delete from other devices.)