Some authorities explain that the purpose of banging the stones is to curse Haman the rosha. Since Haman is descended from Amalek, we also fulfill the precept of destroying Amalek by erasing Haman’s name and image when banging the stones together.
Others say that it is an expression of joy and praise that we defeated the rosha and his family.
The Custom
The custom among most of Klal Yisrael is to bang on the tables or floor when Haman’s name is recited during the Megillah. This custom should not be abolished, as it was established for good reason.
HaRav Eliezer Deitch, in his sefer Shu”t Pri HaSodeh (3:42) writes very emphatically about the importance of this minhag and he writes: "It was not for nothing that ru’ach hakodesh appeared in the beis hamedrash of the Rema, here is the only place the Rema concludes ‘don’t abolish any custom’ and it is known that every Mechaber who writes things for the sake of Hashem, merits to have ru’ach hakodesh leave his mouth, especially our master the Rema, who the entire Klal Yisrael relies on, and he knew that many would mock the custom of banging for Haman, and he warned with a double and redoubled warning not to abolish the custom."
Based on the above, the Pri HaSodeh rejects the questioner (sho’el) who wanted to cancel the custom of banging for Haman, due to the fact that some people were refraining from coming to shul due to the banging which disturbed them, and he concludes that they have no right to stop those who are following the ancient custom that is brought down by the Rema.
Reasons
Below we will detail other reasons for banging stones together as mentioned above, and the custom of stamping feet and other sources of noise.
The Name of the Wicked Shall Rot: The pasuk says, shem reshoim yirkav “The name of the wicked shall rot.” Since young children do not know how to say this, they bang when the name Haman is mentioned instead.
Others base the custom on the pasuk (Devorim 25:2): v’haya im ben hakos harosha. The words v’haya im ben end in hey mem nun – Haman. This is followed by “hakos harosha – bang the rasha.” In addition, the gematria of macho emcheh is zeh Haman.
The Chasam Sofer opines that the reason for the banging is to show that we do not want to hear his name. Obviously, we do not want to miss a word of the Megillah. Rather, we show our displeasure at the need to hear Haman’s name.
Eradicating Amalek: Another reason is that we have a mitzvah to eradicate Amalek in every generation. We are in a constant battle with them. As a sign of war, we bang when Haman’s name is recited. This reminds us of our obligation and keeps us focused on the proper intentions which are needed for the mitzvah to eradicate Amalek.
The Sefer Matamim gives the following reason: Haman’s name is mentioned fifty-four times in the Megillah. This is hinted to with the words macho emcheh, “I will surely erase [Amalek].” The gematria of the word emcheh equals fifty-four.
A Loud Noise: The Chida writes an additional reason for banging when saying the name of Haman: “The reason they used to make a great noise and publicity when banging for Haman, to the extent that the earth would split open due to the sound, was because Chazal saw that we were going to be in a long bitter exile, and they feared that a new king would arise who would want to make decrees similar to Haman. Therefore, they enacted that we make great publicity and rejoice in the streets and marketplaces, in order that the non-Jews would hear a loud noise and strange things, and they would ask what it was all about, and they would get told about Haman and what happened to him, and they would take a lesson in mussar from it, and be careful not to try and repeat the same thing.”
The Chida adds, that this is peshat in the song: “They will hear about what happened to Ben Hamdosa (i.e. Haman) and fear will fall upon them.”
Haman Feels the Blows: The Shevet Mussar, R’ Chaim Palagi and the Kaf HaChaim all write that they have a kabbalah [tradition] that when one bangs when the name of Haman, his wife or children are mentioned, Hashem makes them feel the blow and feel the pain. The reason for this is: Every Yid that comes to the world is considered to have experienced the Purim miracle, as if Haman’s plot would have come to fruition, no more Yidden would have been born. Consequently, every Yid that comes to the world needs to cause Haman pain, therefore, Hashem makes it that Haman feels the pain when one bangs when hearing his name.
They bring from R’ Yehudah HaChossid the following: “Once the minister of Ranzburg asked Rabbi Yehudah HaChossid, ‘Why do you bang on the walls when you mention the name of Haman?’ He answered: ‘The more we knock, the more the demons knock on him in gehenom.’ He said to him, ‘How do you know this?’ He said: ‘Come and I will show you’. They went together and Rabbi Yehudah HaChossid showed him the entrance of gehenom and he saw that he had been beaten. The Minister then said: ‘If I were with you, I would help you beat him.’”