There is no 'legally demand'. Anybody can demand anything. There IS 'legally entitled'. If both names are on the lease, then the return of deposit, if paid by check, will be made out to both names on the lease, no matter what you 'demand'. If payment was made electronically, it may be returned electronically to the same account, but most landlords don't bother with that, they just issue checks.
Who paid what is not an argument in court. When two people jointly own a piece of property and one person pays for everything and the other person never pays a cent, guess what happens to the equity in the property when it is sold. That's right, it gets split 50/50. The argument of 'But I paid for everything!' carries NO legal weight.