Raw garlic turns black when cooked for a long time at a low temperature. The darkening happens when sugar and amino acids react with heat which produces additional substances with a browning effect. This is similar to when meat gets darker as it's cooked in a pan or grilled.