Hydrogen peroxide is water with an extra oxygen atom attached. The bubbles are the release of that extra oxygen molecule, and that's how it cleans wounds of anaerobic bacteria. The word "anaerobic" means that they can't live in an environment high in oxygen, and so hydrogen peroxide rids the wound of such bacteria.
Hydrogen peroxide (I will call H2o2) is a basic solution. In most college biology classes you'll do a lab in which you explore an enzyme (I actually do this with my ap bio students). In all of our skin cells is an enzyme known as "Catalase". When h2o2 comes in contact with this enzyme is facilitates a reaction that causes bubbling - aka water and o2 release. This bubbling has nothing to do with why it cleans wounds. The pH of the h2o2 actually kills bacteria. Believe it or not, our body naturally produces h2o2 but has to use catalase to get rid of it because if it didn't we would die (this occurs in the liver)!