Banks don’t really store money, you give them money and they give you bank credit, and then later on you exchange that credit back for money or transfer credit to someone at another bank and the two banks settle that with some asset (could be reserves etc.).
I think this is the main confusion, of course the physical cash the bank gives you for a withdraw might have been given to the bank during a deposit transaction, but in terms of the transactions on the balance sheet it did not come from there.
Never mind $500, they don't even need to touch the $1000 you put in. They are just making it up as they go because they're a bank and can credibly assert that they will be handling capital in future.
They are using the FACT of having deposits to get the credibility to make up whatever loans they want. This is why leverage is like ten to one making the amount of capital in the world many times the assets of the world and everything in it.
When you withdraw $500 _they_just_make_it_up_.
Someone else goes to the bank and says ‘I want to borrow $1000’
Great the bank says, approved. And they set up a bank account for you that says you have $1000 in it.
Now they’ve got $1000 in reserves and 2 accounts that claim to have $1000 in it.
Now when you withdraw $500 where does that money come from? I can assure you it’s not from the banker’s wallet. That’s coming out of my deposit. Not from my account because my account still says they have $1000 on hold for me, it comes from the actual cash I deposited. (Which of course isn’t actually cash in most cases)
None of that matters in practice because unless everyone tries to withdraw all the money at once there’s plenty to cover all the withdrawals, but they are definitely using money from deposits to cover withdrawals.