When you are in legal hot water you want the best defense possible. That sometimes means having to pay a hefty price for your freedom. A top notch defense lawyer isn't cheap, but it's for a good reason.
When you can't afford to hire a lawyer, the court can appoint a government-paid lawyer - AKA public defender - to represent you. The only way you can get a public defender is by convincing the judge that you can't afford to hire a defense attorney. Sometimes the judge may ask you to provide the court with documentation, such as your work paystubs, in order to prove you can not afford to hire an attorney.
There are quite a few cons to being represented by a public defender. You must remember that these lawyers are paid by the government and usually have a huge overload of cases, which means they may not spend much time on your case. It's a frightening thought, with your freedom on the line, that you might have little to zero access to your lawyer. Another important factor to keep in mind is the age and experience of a public defender. They are usually fresh out of law school and a bit "wet behind the ears". What happens if you don't like what your court appointed attorney is planning? Tough! It's very difficult to have your current public defender replaced with another one.
While it could cost you a significant amount of money, hiring a defense attorney gives you a substantial advantage for possibly winning your case, compared to a public defender.