If you are unable to afford your car loan you may chose to voluntarily surrender the car to the bank. After the bank has the car they will sell the car at an auction. They will apply the proceeds of the sale to the outstanding balance you have on the loan. If the bank collects more than you owe on the loan they will send you a check. However, if they do not collect enough at the auction to pay off the entire loan the bank will send you a bill for the deficiency.
If you owe a deficiency, you have a few opinions. Of course you could pay the bill, work out a payment plan with the bank.
Bankruptcy may also be an option. Bankruptcy will discharge your legal obligation to pay the deficiency.
Also, you may be able to save the car and reduce your car payments in bankruptcy by redeeming in chapter 7 or cramming down in chapter 13.