When a person has been charged with a crime, they may think they can talk their way out of the charges or handle the case in court on their own. They may have some knowledge of the law, especially if this isn't their first time in court, or may assume for whatever reason that they don't need the services of an attorney. This can be very shortsighted and very damaging to your case; note a few reasons why it's never wise to go without a lawyer when charged with any crime.
Lawyers know how to argue against evidence and even get it suppressed. You may think you can tell the prosecutor that they can't bring in certain evidence against you, but unless you know the proper grounds for having evidence dismissed and are experienced in arguing against that evidence, it may very well be allowed in court.
Filing and Paperwork
Courts are sticklers for paperwork; you need to have certain papers filed with the courts by a certain day or you may actually wind up losing your case. That paperwork also needs to be worded and formatted correctly or it could simply be discarded. Attorneys know all the rules about paperwork, filing deadlines, formatting, and the like and can ensure this is all handled properly.
"Guilty" and "not guilty" are not always the only two pleas you can enter into court. There are other pleas you might enter that would work in your favor and which can help you to avoid severe criminal penalties, sometimes even before your trial begins. Attorneys understand pleading options and can also typically negotiate better with a prosecutor to get charges reduced if you agree to certain pleas and conditions; this can help you avoid jail time, having certain charges on your permanent record, and the like.
Don't downplay how your emotions might cloud your judgment when charged with a crime and having to face a court. You might get angry and frustrated when you suspect things are not going your way or you don't understand certain parts of the process, and this might not look good to a jury. You might also become far more nervous in court than you assume and, again, you might overlook certain details, not be able to make your points clearly, or otherwise respond in ways that are not in your favor. An attorney is emotional detached so he or she can give you practical advice on your case and manage their presentation better.