This is a question I receive a lot. And there are actually a lot of reasons why people may sniff as you pass them. Usually none of the reasons have anything to do with the fact that we potentially have a bad smell. Simply because one cannot smell the other person while passing by. It is only in the slipstream that the scent of the other person can be noticed. On the moment of passing by, there is no change to smell the other person, because our human scent does not walk faster as we do. It is always behind us; not in front or next to us. People that are focused on their scent are however very aware of signals in their surroundings. So it is understandable to think that they sniff of snort because of your scent. However, that is generally not the case.
It is unconscious and people do it without even thinking about it. One main reason why people sniff or snort while passing by is to mark their territory. As we don’t know the other person, it is a sign of saying that they are walking there, that they are passing by, that they want to guard their personal space and to sign that we shouldn’t come to close (and bump in to each other). Another reason why people do it is to sign that they are harmless and won’t hurt you. It is a non-verbal manner to indicate that they are not a threat nor aggressive. Another reason is to simply make a noise in a socially awkward situation. The noise breaks the silence and makes it more comfortable in each others (short) presence.
A sniff is also a way to indicate that people are thinking. It is to signal that they are minding their own business and that they are not checking you out or paying any attention to what is going on. It is a non-verbal way to say that they are not judging you or deliberately watching the short and awkward exchange. All-in-all it is merely a distraction of the short meeting two strangers are having. It is generally harmless and only in very rare cases it has anything to do with the other persons scent.
Most people are doing it. Given the many questions I have received on this topic, I have been noticing it myself. Even more so, I found I was doing it myself as well, before I put any mind to it. Now, I don’t do it anymore, and simply observe the unconscious and completely harmless reactions that people do while passing by. Hello, I am here minding my own business!