Smells in themselves do not cause harm. A smell is a neural response to airborne molecules binding to receptors in the mucus membranes of your nose. You can’t be harmed by a smell any more than you can by a colour.
But the chemical that causes the smell can harm you. In general, we have evolved so that harmful substances smell bad, to warn us.