It is a tradition.
Judges and lawyers wear wigs to show dignity, because research shows that this tradition began in the 12th century, but it was not exclusive to judges and lawyers at that time. Many upper-class people wore wigs as a kind of attire for formal occasions, so they were also used in court. Hong Kong lawyers wearing wigs are also related to hair loss. It turns out that in the Middle Ages, judicial officers had to wear wigs because their hair quickly fell out due to overwork. In order to cover up his baldness in public, he wore a wig, and this habit gradually continued.
Wearing a wig reminds you that you are a law enforcer. The inspiration for us is that when judging things, we should also be like judges. Put aside personal experiences, emotions, and interests, and make objective and fair judgments. Wearing a wig and a lawyer's robe is so that the judge will not affect the judgment based on identity and appearance, and all decisions will be fair and just. The wig retains its original appearance and traditional form. But essentially it has been given a new meaning.