There is nothing as bad as running an air conditioner (AC) that is circulating foul air in your house. Here are some measures to help you prevent the problem:
Ensure the Unit is Properly Sized
What has the size of the HVAC unit got to do with bad odor? Well, if the unit is too large for your house, it will not be able to dehumidify the house (this is what latent cooling refers to). The high levels of humidity will encourage mold and moss growth in different parts of the house or even in the unit itself. This is why HVAC sizing is best done by professional technicians.
Flush the Drain Line Regularly
The drain line is responsible for channeling condensation out of the air handler to the outside of the unit. This means that it is perpetually moist, a condition that encourages mold and mildew. The buildup of dirt and grime in the drain line can also emit foul odors. Therefore, flushing the drain line regularly is a good way of eliminating its associated bad smells.
Clean the Drain Pan
The drain pan, which collects condensation from the air handler to avoid leakage, is also constantly wet and suffers the same problems as the drain line. This means that it should be regularly emptied and cleaned so that it doesn't smell, too.
Clean the Filter
The filter does its work by trapping debris in the air entering the unit. This debris remains on the filter until you wash or change it. This means if the filter has been in use for a long time, then it is probably chockfull of debris, and such debris always smells. Therefore, if your HVAC system is emitting foul odors, the filter is one of the places you should check; swap the filter with a new one or wash it if it is washable.
Keep It Free Of Decaying Organic Matter
A typical HVAC system collects organic matter in its different parts. For example, if the top or access panel doors are open, they may let in rodents such as mice and snakes that may get trapped and die. Windblown debris, such as flowers and leaves, may also get trapped by the unit. Don't forget that mold also thrives on moist organic matter, so such things also increase your unit's susceptibility to mold growth. Therefore, check the unit and confirm that it is free of such organic matter and close the panel doors to prevent contamination.
If you can't find the source of the bad odor, contact a professional AC repair company for help.