We are beginning siman 12. The Chayei Adam writes that the same way one must distance from tzoah, one must distance from bad smells as well. It is similar to tzoah, as the same way one finds tzoah repulsive, bad smells are found to be repulsive as well. However, the Chayei Adam will point out that we are specifically referring to bad smells which come about through the process of decay, similar to tzoah. Tzoah breaks down (which is similar to the decaying process) through the body, which leads to the bad smell, and it is from similar bad smells (i.e., where there is decay) which one must distance.
A natural bad smell, which did not come about through the process of decay, does not require distance. The Mishnah talks about lighting Shabbos candles with an oil called itran. Although it has a bad smell, there is no chiyuv to distance from it, because it is the natural smell of the chemical. (Practically, we do not use it for Shabbos, as we will see below, but there is no issue with reciting torah or davening around it.) The Mishnah Berurah points out that it is an issur deoraysa to speak or think in torah or davening around such a smell.
The Chayei Adam adds that even if one is sick and cannot smell, they must still distance from the smell, in the same way that a blind person must distance from tzoah even though they cannot see it. Similarly, one must distance from it at night, even though they cannot see it.
The Chayei Adam continues, and writes that one must distance from a bad smell specifically when the smell comes from decay, as we mentioned above. The Chayei Adam mentions the itran oil that we discussed previously. The Mishnah says one cannot use itran oil, because it is not kavod Shabbos. The Yerushalmi explains that the Mishnah specifically states that it should not be used because it is not kavod shabbos, to avoid someone thinking that the issue is the need to distance from the smell. Rather, the Mishnah specifies that the issue is kavod Shabbos because there is no issue with the smell, since it is natural and not the result of decay.
Summary
One must distance from a bad smell which comes as the result of decay in the same way they must distance from tzoah.