Deleting a mail move it to the local trash folder, whatever is configured in the settings. It's not possible to move deleted mails to the IMAP trash folder. Move manually works as expected.
Had the same issue yesterday after a lot of fidling. Fixed itself after a full system restart for me (at least for now). Potential duplicate of: https://bugs.kde.org/show_bug.cgi?id=357945 Might also be related to: https://bugs.kde.org/show_bug.cgi?id=371664
Seems to be fixed in 5.4.2 or 5.4.1.
Just tested this again, my instance is definitely a reproduceable duplicate of https://bugs.kde.org/show_bug.cgi?id=371664 This one may be closed. :)
*** This bug has been marked as a duplicate of bug 371664 ***