If you entered into a contract with the car company (dealer, leasing company, whoever), you agreed to pay a certain amount of money up front, a certain amount of money each month for the specified amount of months, and if it's a lease, a certain amount of money at the end of the lease term to either turn in the car or buy it from them. You also agreed to late payment fees and most likely to pay for collection costs.
They agreed in return to give you the car. They also kept title to the car, or a lien on the title, until all your payments were satisfied.
At some point you weren't making the payments, and they took the car back so that they'd stop losing money on you and have something to sell or lease to someone else to pay off what you owed them. They value the repossessed car at a certain value. If this is less than the sum total of what you owe them, they can sue you for the rest.
Even if you don't have the car, they're entitled to what they bargained for, which is their profit on the deal, and also to be paid for their trouble trying to chase you down to get this profit.
Imagine this scenario: you collect vinyl records. You have a collection of 100 rare records that you built up over a while. You spent $200 on them over time, but they're worth $1000 on the open market now. You want a big TV, so you decide to sell the records for $1000. But the buyer doesn't have that much, so you take $100 down and $100 a month for 10 months. I.e., you are being paid $100 interest for having to wait 10 months to get all your money. You agree that if the buyer doesn't make the payments, you can take the records back - you would sell them to someone else, keep what you're owed, and if there's any left over, you would give it to the original buyer. Then you buy the TV and agree to make monthly payments on it, part of which will come from the record buyer's payments.
The buyer pays for three months, and then stops. Now you're in a jam, because you still have to make the payments on the TV. So you take the records back. But some of them are scratched or missing their jackets. You can sell them now for only $400. This means you have $400 from the original buyer, and $400 from the new buyer. It cost you another $100 to take back the records and resell them. Your original deal was to get you $1100 for the records, and you now have only $700 after expenses. The original buyer still owes you $400 even though he no longer has the records.
This is just a rough example. The car company probably biases the contract so that if you stop paying, you get socked with heavy penalties and they end up with more money than they bargained for. But you agreed to that when you entered into the contract to begin with, and they really don't want to be doing this, they probably make more than enough money on the original deal compared to what they'll make from from repossessing a car and going after you.