De UC Davis :
Question: Why did my garlic turn blue? Answer: Garlic contains anthocyanins, water-soluble pigments that can turn blue or purple under acidic conditions. This is a variable phenomenon that is more pronounced for immature garlic but can differ among cloves within a single head of garlic. If you grow your own garlic, be sure to mature it at room temperature for a couple of weeks before using it.