Yes. Banks have the right to take funds in checking or savings to pay a past due debt owed to the same bank. This is often stated in the small print of the account agreement but it need not be in the account agreement for the bank to take a deposit to pay on a debt owed to the bank.
Look at your agreement with the bank. If it did not have the right to take the money, see a consumer lawyer in your area. Want to know the law? Sign up for our free newsletter on varies areas of the law by sending an email to firstname.lastname@example.org and requesting the newsletter, or go to www.ConsumerLawyerHelp.com