Peeled garlic cloves turn green in vinegar due to a chemical reaction between amino acids in the garlic and sulfur compounds, which are enhanced by the acidity of the vinegar. This reaction produces pigments that cause the green or blue-green discoloration.
The greening of garlic in vinegar is a natural chemical process and is generally harmless. Garlic contains enzymes and sulfur compounds. When garlic is damaged (peeled, cut, or crushed) and exposed to an acidic environment like vinegar, these enzymes react with the sulfur compounds. This reaction produces compounds called thiosulfinates, which can further react to form pyrroles. Pyrroles can then link together to form colored pigments. The specific color depends on the exact compounds formed, but it's usually a shade of green or blue-green. The acidity of the vinegar accelerates this process. The amount of amino acids and sulfur compounds can vary between garlic cloves, which is why some cloves might turn green more intensely than others. The presence of trace metals in the water or vinegar can also influence the color.
To minimize greening, blanch the garlic cloves in boiling water for a minute before pickling them in vinegar. This deactivates the enzymes responsible for the reaction, reducing the likelihood of discoloration.