A white layer in garlic oil is usually caused by solidification of compounds like stearic acid and palmitic acid, which are naturally present in garlic, when the oil is stored at cooler temperatures. It's generally harmless and doesn't affect the flavor.
Garlic contains various compounds, including fatty acids like stearic acid and palmitic acid. These compounds are naturally present in garlic cloves. When garlic oil is stored at temperatures below room temperature (typically below 70°F or 21°C), these fatty acids can solidify and precipitate out of the oil, forming a white, cloudy, or even solid layer at the bottom or throughout the oil. This is similar to how olive oil can solidify in the refrigerator. The process is reversible; warming the oil will usually cause the white layer to dissolve back into the oil. The presence of moisture can also contribute to cloudiness, as water can emulsify with the oil and create a hazy appearance. However, the primary cause is the solidification of fatty acids. The white layer is not a sign of spoilage, but it can be visually unappealing.
To prevent the white layer from forming, store your garlic oil at room temperature (ideally between 70°F and 75°F or 21°C and 24°C). If a white layer does form, simply warm the oil gently (e.g., by placing the bottle in warm water) until it disappears. Avoid overheating the oil, as this can degrade its flavor and quality.