In general, canning oils at home is unsafe (unless you have a pressure canner and take it up to 121C). Canning water-based stuff with high acidity (pH < 4.3 or whatever) is pretty safe, as long as you follow a safe procedure and the seals are intact.
The botulism spores are abundant in soil, but they don't get activated unless the conditions are met. The main condition is an environment without oxygen and the presence of proteins, which happen both in sealed oil-garlic containers.
Most factory-made food has preservatives and other stuff that stabilize the food and prevent botulism. In particular many foods use vinegar to increase acidity and make it impossible for botulism to bloom.