The bank's account disclosure agreements determine order of processing. Usually, though, deposits are processed before withdrawals. That's how it's supposed to be done. The only exception would be, for example, a deposit made through the ATM after the cut-off time (so they didn't really have it) or if there was a hold on the deposit for some reason. There might have also been pending debit card purchases that caused the account to appear to be overdrawn. Another possibility, if you could see the checks when you made the deposit, is that they were actually received for processing the day before the deposit was made.

The starting point here is to call the bank and ask them what happened. They should be able to explain why the fees were charged. It could be a mistake. In many cases, they'll refund the fees if you ask them to, or if they see that the deposit should have covered the items. They don't have to, unless they made a mistake, but some banks will do it as a customer courtesy. You can also ask them to send you a copy of the account disclosures so you can see what it says about order of posting. Many banks also publish this information on their websites.

If you have any questions or concerns about what I've written, please reply so that I may address them. It's important to me that you are 100% satisfied with the service I provide. Otherwise, please rate my service positively so that I get credit for answering your question. Thank you.