Can a landlord keep your deposit for past late fees dating two years ago in California
Yes, the deposit is to cover performance of any obligation under the lease, including any payments due under the lease that have not been paid.
Yes. Technically the landlord subtracted the late fees from the deposit two years ago when you were late rather than subtracting it now that you are leaving.
No. Late fees are illegal. See caltenantlaw.com .