This is the concept of "locked capital/money" as a guarantee or collateral.
Say you have $5,000 limit to spend on your card. The car rental company took deposit of say $2,000.
This $2,000 money isn't going anywhere, but remains in a locked state as a collateral. It will not leave your credit card account.
However, till the time you hold the car, this money will NOT be available to you for spending. You can only use the remaining $3,000 on your card, as $2,000 is locked as collateral.
In case you return the car in time, this lock will be removed as the car rental company release it, and you will have the full credit of $5,000 on your card for spending.
However, if you don't return the car, the car rental may not release your collateral money, or in the worst case scenario, they may charge your card - that is, the money will then actually get transferred to their account permanently from your card. Then you will be liable to pay the credit card dues to your card issuing bank.
So as long as you honor your timeline to rental car company, all will be good. Just remember that the locked amount is not available so don't swipe your card for excessive amounts beyond the remaining limit.