As Joy Black already said, it reacts to produce bubbles of oxygen.
But let me add that even though my mother used peroxide to clean her kids’ ears, and I continued the practice well into adult life, it is a bad idea to use peroxide in the ears, on wounds, etc. The bubbling action gives one a reassuring feeling that it’s doing something good to clean the ear canal or a dirty wound. However, it is a highly oxidizing substance and causes undesirable oxidative damage to one’s own tissues, potentially doing more harm than good.
Not good
Wounds cleaned with peroxide often are slower to heal than those cleaned by safer methods because of the damage done to healthy tissue around the injured tissue. Where use in the ear is concerned, I would worry about corrosive effects on the delicate eardrum, hence on the sense of hearing, especially if one does this habitually over a period of years. Rubbing alcohol is another product to be avoided for disinfecting and cleaning wounds.
There are still many web sites recommending hydrogen peroxide for earwax removal, but since reading more about this in recent time, I have stopped using it. You can get safer and cheap ear-cleaning products at any pharmacy or health section of Walmart, grocery stores, etc., and safer disinfectants for cuts and scrapes.