Many poskim who discuss this halachah say that children have the custom to bang, but make no mention of an adult doing this. Nonetheless, since some poskim mention that an adult should bang a little, this should be done.
Although we normally discourage parents from bringing very young children to shul, it is common to find this at the Megillah.
The Shulchan Aruch rules: מנהג טוב להביא קטנים וקטנות לשמוע מקרא מגילה - “It is a good custom to bring young boys and girls to shul to hear the reading of the Megillah”. The Mishnah Berurah writes: שכיום נהפוך הוא שהילדים לא מגיעים כדי לשמוע את המגילה רק לדפוק את המן ולא מתקיים בזה מצות חינוך, ומבלבלים את דעת השומעים, וחוב על האבא להשגיח על הילד שישמע היטב את המגילה, וכשיגיע הקורא להמן האגגי יכה כמנהגו, ועיקר הגעת התינוק לבית הכנסת יהיה לקריאת המגילה – “Today, the opposite is true: children do not come to hear the Megillah, rather they come to bang for Haman, and this does not fulfill the mitzvah of chinuch and it just confuses those who are trying to listen. There is an obligation upon the father to watch over his child and to make sure he listens properly to the Megillah, and when the ba’al koreh reads “Haman Ha’agagi” he may bang like the minhag, however, the main purpose of the child coming to shul should be to hear the Megillah.”
The Biur Halachah (d.h. minhag tov) explains that the Shulchan Aruch is referring to children that are of the age of chinuch, and due to chinuch it would be enough for them to hear Megillah at home, however, due to pirsumay nisa the Shulchan Aruch says they should come to shul. However, very young children shouldn’t be brought to shul as they just confuse and disturb people.
From the Biur Halachah it is clear that very young children shouldn’t be brought to shul, however, the minhag in many places is that they are. To explain the minhag some suggest that Haman wanted to destroy the Yidden from very young children to old men etc. After the miracle, the Megillah says that these days of Purim will not pass by the Yehudim and their remembrance will not pass their “zaram” (Esther 9:28). The Gaon says that Yehudim refers to adults, and zaram refers to children. Accordingly, children of all ages should hear the Megillah, and the way we get them to come to shul is for them to bang when Haman’s name is said in the Megillah.
The Mekor Chaim says that the custom applies to women as well.