This is described with better detail (and better prose) in John Baker's classic description at StainsFile, but to summarize: The procedure you're describing is a regressive hematoxylin stain with Harris hematoxylin. To start off with, let's bear in mind that hematoxylin, a compound from the wood of the logwood tree, is actually used as hematein, by oxidizing it with sodium iodate. (The colorless hematoxylin would naturally "ripen", oxidize over 4-10 weeks in the presence of air, even without that step, but this is more controllable) Additionally, aluminum ions are added as a mordant, creating hemalum by binding =O and -OH on the hematein. The Al atom is what actually binds to something in the nucleus (I found reference to lysine side chains of histone proteins and the phosphate of the DNA - I haven't sorted this part out yet).
When acid is added, it competes with aluminum, which can be thought of as Al3+. The real bonding may be more covalent than that, but that point is considered controversial. For whatever reasons, the H+ interferes with the Al3+ mediated attachment of stain to tissue, especially at sites of background attachment (differentiation). The hematoxylin washes away somewhat, leaving lighter, more specific staining. (this tactic is called a regressive stain, and is certainly not needed to do the procedure. This is very much more art than science at this point...)
But ... the acidic hematoxylin has a reddish color, and it isn't as blue as it can be unless it is neutralized to around pH 8 - hence the second step with bicarbonate, though often plain tap water can be used. That is an ordinary instance of a dye changing color with pH, and can be called "bluing the hematoxylin".