Most laundry bleaches, including the household wizard Clorox bleach, are oxidizing agents.
In the washing machine they release free-roving molecules of sodium hypochlorite or peroxide. The color of a stain or spot is made up of a group of atoms and molecules linked together by a pattern of double and single bonds.
The oxidizing agent tears into those bonds, destroying the bond pattern and fading the color or changing it completely to white. The stain is still there, albeit invisible, until detergent and the agitation of the machine lift most of it off.
Fabric colors are also made up of bonds, so that if you add bleach to the wrong kinds of wash loads, clothes that aren’t colorfast, you’ll notice that the colors you liked might also become invisible.