Anthocyanins are highly susceptible to heat and light. You may have seen this anomaly in apples, which sometimes appear more red on one side than the other.
This happens when the red side was exposed to more sunshine, spurring a chemical reaction in the plant cells that produces more pigments.
When it comes to purple beans, however, heat plays the principal role. Boiling, baking, or sauteing at high temperatures causes the anthocyanins to deteriorate.
The heat breaks down the plant cells, diluting the acidity of the cell sap as the pigments are dispersed in a more neutral solution (water).
What’s left behind is green chlorophyll, which was always present in the beans but masked by the plant’s anthocyanins. So, your purple beans end up as green beans and the boiled water looks blue from all the pigments that escaped.