Garlic itself is a nutritious food, and its sulfur-containing compounds have been studied extensively. But eating garlic as part of a balanced diet is very different from inhaling smoke produced by burning it.
There is also a popular belief that burned garlic can repel mosquitoes and other insects. The strong odor may be unpleasant to some insects, but burning garlic is not a dependable substitute for proven insect-control methods. If mosquitoes are a concern, eliminating standing water, using appropriate screens, and using registered insect repellents are much more reliable approaches.
If the goal is to remove an unpleasant smell from a kitchen or room, burning garlic is also not the best solution. The smoke may simply replace one strong odor with another and can leave a lingering smell on fabrics, curtains, furniture, and clothing.
A safer approach is to identify the source of the odor, improve ventilation, clean the affected area, and use appropriate odor-control methods. Opening windows when outdoor conditions allow, using an exhaust fan, and keeping cooking surfaces clean can make a much greater difference.
There is, however, a perfectly reasonable culinary use for exposing garlic to heat.
Roasting garlic gently can transform its flavor. Instead of becoming black and smoky, properly roasted garlic becomes soft, creamy, mellow, and slightly sweet. The intense sharpness of raw garlic decreases as it cooks, making roasted garlic excellent for spreading on bread or mixing into sauces, mashed potatoes, soups, vegetables, and dressings.
To roast garlic safely for cooking, separate the cloves or roast a whole bulb in an oven rather than holding it directly over an open flame. A moderate oven temperature allows the garlic to soften gradually without producing excessive smoke.
Once the cloves become tender and lightly golden, they can be squeezed from their skins and used immediately.
This is very different from intentionally burning garlic until it becomes black.
If you accidentally burn garlic while cooking, ventilate the room and remove the burnt food. Don’t deliberately breathe the smoke or use it as a home remedy.