I agree that fermentation from bacteria is the most likely explanation. So, to tackle your questions point by point:
It is unsafe, as the other posts already mentioned, due to botulism danger. Plant matter without access to oxygen is not shelf stable, unless it has been pickled with sufficient acid.
There will be some chemistry going on between garlic and oil, but not much of it. Most of it will be solubility stuff; some reactions will probably happen too, but nothing you will notice. Most important, there will be no oil-garlic explosions.
The results you are seeing are most likely caused by some microorganism (bacteria or yeast) gorging itself on the sugars in your garlic and burping out some gas, probably CO2. There is nothing strange about the gas building enough pressure to get a bit of oil out. Brewers can tell you that you never stopper a bottle or carboy in which something is undergoing primary fermentation, else your cork blows out or the whole vessel shatters. If you ever popped a champagne bottle, you know how much force you can get in there.
The gas from the fermentation could not dissolve in the oil (the way it would had happened with CO2 in a watery medium). It built up pressure against the cork. I suspect that the cork was not perfectly tight, else it'd have shot out. Instead, the foam probably pushed it up a bit until it could flow around it, and got out. The pressure fell, and the remaining oil stayed in the bottle.
The results you are seeing are most likely caused by some microorganism (bacteria or yeast) gorging itself on the sugars in your garlic and burping out some gas, probably CO2. There is nothing strange about the gas building enough pressure to get a bit of oil out. Brewers can tell you that you never stopper a bottle or carboy in which something is undergoing primary fermentation, else your cork blows out or the whole vessel shatters. If you ever popped a champagne bottle, you know how much force you can get in there.
- The gas from the fermentation could not dissolve in the oil (the way it would had happened with CO2 in a watery medium). It built up pressure against the cork. I suspect that the cork was not perfectly tight, else it'd have shot out. Instead, the foam probably pushed it up a bit until it could flow around it, and got out. The pressure fell, and the remaining oil stayed in the bottle.
As to making yummy oil with garlic safely, TonyArra already told you: you can keep it in the fridge and eat it up within a few days. Don't top it up with new oil! It is perishable just like mayonnaise or milk, but the ugly part about it is that you won't notice anything if there is a lively botulinum colony in there. No off smells, color changes or similar. Most bacteria which live in food don't survive without oxygen (c. botulinum is an exception) and the ones which make food smell bad will not be present even if you have botulinum in your oil.
If you want something which keeps, look into recipes which require pickling or freezing. You won't be able to get a garlic oil with them, but maybe a garlic spread will work for your bread too.