The person paying the security deposit would credit the asset account Cash and would debit the asset account Security Deposits. The person receiving the security deposit would debit the asset account Cash and would credit the liability account Security Deposits Returnable.
Let’s use an example. Monica pays the landlord $500 as a security deposit as required by the lease for the apartment she is renting. If she causes no damage, she has a right to the $500 at the end of the lease. She gave up an asset (Cash of $500) but has another asset: the right to $500 at the end of the lease. The landlord receives the $500, but has an obligation to return the security deposit at the end of the lease. The landlord received an asset (Cash of $500) but has a liability to return the $500 at the end of the lease (unless there are damages).
As the example showed, a security deposit is an asset for one party and the same security deposit is a liability for the other party.