Usually, yes, if allowed under the terms of your deposit account agreement and loan contract.
Generally, a bank may take money from your deposit account to make a payment on a separate debt that you owe to the bank, such as a car loan, if you are not paying that loan on time and the terms of your contract(s) with the bank allow it. This is called the right of offset.
Your deposit account agreement or loan agreement should contain an explanation of when the bank may exercise its right.
However, federal law limits what a bank can do in some cases. For example, federal law won’t allow a bank to offset your deposit account to pay off your consumer credit card account.