As long as you don't sell the vehicle to someone who is considered an "insider," such as a family member, friend, or business partner, I don't see that you would have a problem if you sold the vehicle, bought something else, and spent the rest on necessary living expenses.
Hope this perspective helps!
What you are proposing would be considered proper planning for bankruptcy. You could sell it to an "insider" as long as you received fair market value for it, which you should make sure you receive from any purchaser. But with an insider, you would need to clearly document the fact of fair market value, because there is no built-in safeguard for that when selling to an insider, and the trustee would inquire about it. So I agree that it would be best to not sell it to an insider.
Also, if the value of the car is reduced because of needed repairs and/or poor condition, you should document that fact the best you can, including photos and written statements from repair shops.
I am not sure who told you the trustee would take your vehicle and give you $5,000.00, but this number could be based upon the exemptions available to you in Arizona.
However, the issue of the value of a vehicle to the bankruptcy estate is often different than its actual value. For the estate to derive money from the vehicle, it has to be sold and often the trustee would rather take a smaller amount from you than go to the effort to sell the vehicle.
Another issue is how much money you are permitted to exempt at the time of the filing of your bankruptcy. This also differs from State to State.
Much of the question you are asking is an issue of local practice. You need to consult with an attorney.
I would like to offer a few points that have not been discussed in the other answers. In Arizona, an individual is allowed to claim an exemption of up to $5,000 for one vehicle. However, if you are married, you and your spouse each get $5,000 and you can allocate the entire $10,000 exemption to one vehicle.
The answer for you also depends on what chapter of bankruptcy you plan to file. If you file a Chapter 13, you can keep the car by paying the amount of equity in the vehicle into your Chapter 13 plan over 3 to 5 years (depending on your income). From the numbers you give, this would be around $8,000. If you file a Chapter 7 bankruptcy, there may also be ways to keep the vehicle, although there are more limitations in a Chapter 7.
If you sell the vehicle, you can use the extra money for certain things right before your bankruptcy, but you will want to be careful what you spend it on so you do not expose yourself to liability in a bankruptcy case. The things that you mention in your question (electric, water, phone, food) could qualify as "provisions" in Arizona. The Arizona exemptions allow a bankruptcy debtor to have 6 months worth of provisions that the trustee (and your creditors) will not be able to touch. So you could pre-pay some of these bills for six months or buy six months worth of food.
There are other places you could spend the money where it would be exempt from your creditors, depending upon how soon you file the bankruptcy after selling this vehicle. An Arizona bankruptcy attorney, or the bankruptcy court, could give you a list of these exemptions.