This is one of the largest bugs in Mavericks’ Mail app, which affects Gmail accounts and Google Apps email accounts. This used to work just fine in previous versions of OS X, so it is a brand new problem in Mavericks:
Mail can’t delete messages from the Inbox unless Google’s “All Mail” folder is visible in Apple Mail. If you try to delete a message from the inbox, the message only disappears temporarily, then reappears moments later. It seems like Apple Mail never removes the “Inbox” label from the deleted messages, so the messages just keep reappearing back in the Inbox over & over again.
The workaround is not a desirable one: It requires the user to make Google's “All Mail” folder visible to IMAP clients (via Gmail's "Settings>Labels” page). However, this workaround is not desirable because of 2 bigger problems:
(1) Making the “All Mail” folder visible in Apple Mail will suddenly make dozens of gigabytes of emails start taking up valuable hard drive space, because every single email that has ever been archived on Gmail/Google Apps will suddenly be written to the Mac’s hard drive. This can be a real problem on a machine with a small hard drive, such as the MacBook Air. Hiding the “All Mail” folder prevents these messages from taking up valuable hard drive space. Not to mention that all of these messages are DUPLICATES OF MESSAGES THAT ALREADY APPEAR in other IMAP folders, so showing the "All Mail" folder in Mail is absolutely pointless.
(2) Whenever the “All Mail” folder is visible, every new message that comes into the “inbox" also shows up as a new message in the “All Mail” folder as well, so new messages appear like they are coming in twice. Also, users are forced to mark their messages as “read" in two locations: the “Inbox" AND the “All Mail” folder.
The ideal solution would be for Mail to operate how it used to operate: Users should be able to delete messages from the Inbox, without having the “All Mail” folder visible in Apple Mail.
Please report this bug to Apple at http://www.apple.com/feedback and hopefully they will fix it in a software update soon!