It is not really making you vomit not directly, it is making you nauseous if you become too nauseous you vomit.(nausea has multiple triggers but for this I will stick to smell) Nausea exist to keep you from eating toxic food and to help you get rid of it if you do, the reflex is a balance between the biological cost of a meal(minimal) and the cost of being poisoned(extreme) so you can see why it might favor vomiting and losing a meal vs not vomiting and dying of poisoning than it would the two costs were not so drastically different.
Now your body can't really tell the difference between a smell coming from inside your mouth and one from outside, they both reach the nose by a roundabout course, and your mouth cannot smell. The closest your instincts can come is assuming a stronger scent is coming from the mouth since it is close and enclosed. That's why a stronger disgusting smell results in a stronger feeling of nausea. the stronger the smell the better the chance it is coming from inside your mouth.
Combine these two concepts and you can see how the stronger the smell and the more disgusting it is the more likely it is to make you nauseous it is the best protection our anatomy allows for. Now of course this is only the the current hypothesis, Nausea is not easy to study nor is it a in high demand for research.
Additional sources