Deleted emails going to junk folder
With IMAP, it is the device (or clients) responsibility to know which folder to put various messages in as actions are performed on messages. I suspect you have an IMAP misconfiguration. There are 4 special folders: Drafts, Sent, Deleted and Archive.  These can be specified for each mailbox on each device that accesses that account.  (Settings > Mail, Contacts, Calenders > (pick your account) >  (pick it again) > Advanced Settings)

To complicate matters you will have to check each device that you have the mail account configured on.  For Example, if it's configured on a MB, iPhone and iPad then check the special folder designations on all 3.   If you are having this problem intermittently that fact suggest these folders are set correctly on one device, but not another.  If you only have this account on one device, the error in setup will still be in this area of settings.