There are a few tricks to getting IMAP on Apple Mail to behave correctly with Gmail. Rather than me spelling this information out, here’s a link to just one of the many articles which explain the steps:

Categories
Recent Posts
Tags
Address Book
Adobe
Alternative Apps
Android
Applications
Archives
Chrome
Dashboard
dock
Encryption
File Handling
Finder
Firefox
Gmail
google
Google Voice
Internet Tips
IOS
iPhone
iPod Touch
iTunes
Keyboard Commands
keyboard shortcuts
Lion
Mac OS
Mail
Mountain Lion
Music
Networking
os x
Privacy
Quicklook
RSS
Safari
Security
Shortcuts
Skins
Spotlight
substitution
Terminal
terminal commands
Tweaks
updates
Web Development
Widgets