Because garlic contains sulfur compounds which can react with copper, it can therefore create copper sulfate which is a compound with a bluish green color. There doesnâ€™t need to be a great deal of copper to cause this reaction so it is fairly common with garlic. There is an enzyme in raw garlic which if it is not inactivated can react with the sulfur in the garlic as well as the copper to form a sort of blue or bluish green color.
The inactivation of the enzyme is accomplished through thorough heating. There are some other explanations as to why you might get a blue or green color with garlic, such as those who use table salt instead of canning salt. By doing this you can cause the garlic to turn a blue or green color. Because table salt contains iodine, it discolors the things you happen to be pickling. It will be important to instead use pickling salt for doing this.