While it is common in California to see everyone from the CEO to the employees wearing jeans and a hoodie, even Mark Zuckerberg wears a suit when he goes to court.
No rule dictates that you must dress or wear your hair a certain way when going to court. Yet the reality is appearances still count for a lot. While many employers have relaxed their dress codes in the past few years, it still pays to dress up for an appearance before a criminal court.
Who cares what I look like?
While having the self-confidence to dress how you feel without caring what others think is admirable, your court appearance is a special occasion. Think about if you were going for a job interview. While there are likely some employers out there who would appreciate your sense of style, many might decide against you the moment they see you.
You cannot afford to take that risk with a court. You have one opportunity to make a great impression on the judge, and anything that goes against that could harm your defense.
Judges can take themselves seriously
You do not see many flamboyantly dressed judges. The establishment and their colleagues would likely see it as unsuitable. Typically someone who becomes a judge will have spent their life abiding by the rules to get there.
You might not think much of the judicial system, but those who work in it believe they are doing an important job. A judge might interpret your refusal to dress for the occasion as a lack of respect for them and the system.
Getting legal help from someone who knows the judge that will hear your case and understands how they think can help you set the right impression and avoid doing anything to offend them.