Why do my shallots keep turning blue?
Vegetables with a naturally blueish-red color - red cabbage, beets, red onions, shallots, blueberries, red grapes (wine too) - usually have that color due to anthocyanin content.

Anthocyanin behaves like litmus paper, and takes on a different hue depending on pH value. If food containing it turns blue, it is too alkaline - and might also be at less than optimal flavor because of that. Add acidity to make it red.

Specifically with shallots, though, do make sure that it is not actually blueish mold getting washed into the cooking liquid. Unpalatable at any pH.