When you face criminal charges, you always have the right to an attorney. In fact, this is one of the rights that police will inform you of when they read your Miranda warning after your arrest. The reason you have the right to a lawyer is because the U.S. court system has many complicated legal requirements. To get a fair trial, you need someone who understands how the criminal justice system works and who understands the steps that you need to take to protect your constitutional rights and to defend yourself.
For example, if your Fourth Amendment rights are violated and you were searched illegally, you will need to file a pre-trial motion with the court arguing that evidence should be suppressed. Understanding exactly how to write a motion, support your argument with legal precedent and convince the judge to keep the evidence out of court requires an understanding of past case law and of civil procedure rules within the court system. If you don’t have this knowledge, illegally obtained evidence could be used to take your freedom and leave you with a criminal conviction.