It was a little disconcerting when the garlic in my potato salad turned bluish-green the other day. What had caused it, and was it safe to eat?
The flavour of garlic is created by a few different sulfur compounds and some enzymes (an enzyme is something that affects the speed of a chemical reaction). Basically, what happens is that when you expose garlic to either acidic environments or low heat the cell tissues are disrupted. This allows the enzymes to get to the base chemical compounds.
The products of the initial reaction then react with amino acids to produce a new compound that absorbs specific wavelengths of light. This results in the colour (Kubec et al, 2004). So when we cut up the garlic and put it in with the warm roasted potatoes the reactions started and the garlic quickly changed colour. It is still garlic, it still tastes like garlic (although some people seem to think it results in a stronger flavour), and it is still safe. The compound that results in the colour is actually really similar to chlorophyll which is a key compound in photosynthesis and gives many plants their green colour.
You are less likely to see your garlic turn green if you cook it on high heat. The higher heat deactivates the enzymes so that the original reaction can’t happen and there is nothing to react with the amino acids (Serious Eats).
Laba garlic is garlic preserved in vinegar. It turns green because of the vinegar, which is an acid, and encourages the reaction described above.