The standard Apple Mail setup has you configure Mail to move all spams that SpamSieve catches to the special Junk mailbox. This should prevent Gmail from archiving the spam messages in All Mail. Make sure that you’ve set the Junk mailbox in Mail’s settings to the same Spam mailbox that Gmail’s own junk filter uses (as described in Setting the Junk Mailbox in Apple Mail). Otherwise, you may see incoming spam messages in both the Archive and Junk mailboxes, and training messages as spam may not move them out of Archive. In some cases you may also want to hide the All Mail mailbox in IMAP, as described in Hiding Special Gmail Mailboxes From IMAP.
Local Spam Mailbox
If you’ve instead chosen to use a local Spam mailbox under On My Mac, you should tell Gmail not to archive messages that are deleted via IMAP (which includes messages moved to local mailboxes on your Mac):
Click the gear at the top right, choose Settings, then click on Forwarding and POP/IMAP.
Select Auto-Expunge off and Immediately delete the message forever.