It's very confusing. A cynical renter will tell you it's just a way for landlords and owners to charge their tenants more money. Finally, it's also supposed to reimburse the landlord for the cost of any cleaning necessary to put the premises back in the condition it was. Most renters will tell you that no matter how hard you take care of a rental unit and no matter how hard you clean when you move out, a landlord will find things to deduct from your security deposit. A security deposit might also simply be called last month's rent instead by some.
Some landlords require a security deposit and last month's rent as well.
In many states there is no limit on the amount of security deposit a landlord can charge. But, in many other states, the landlord cannot charge more than one or two months rent as a security deposit. You'll have to check your state law for the specific limit applicable to your state. But, almost without exception, landlord will require that you put down a security deposit up front to rent the apartment. Normally, at the time you sign a lease, you must pay any security deposit plus your first month's rent.