Can bank accounts withdraw from a different account?

I have 2 bank accounts and overdrafted on one of them because I had autopay for a company that I am no longer with. Today I saw there was 89 missing from my account and when I looked at it, it said they transferred the money to my other account. Can banks do that?