Air conditioner coils develop mold over time because of the moisture that builds up in the evaporator coil. Appliance parts stores sell sprays specifically designed to kill air mold and bacteria in air conditioners. Regularly spray over the evaporator coils to prevent the odor from coming back.
Your air conditioner may have algae or mold in the air filter, which can cause a foul smell to develop. Dust and particles of dirt caught in the filter also can cause an unpleasant odor. Remove the front cover of the air conditioner and find the filter. Remove it and soak it in soapy water. Rinse the filter well and allow it to dry. Clean the area inside the air conditioner, then replace the filter and see if that makes a difference in odor. The filter should be cleaned monthly. If the air in your home is extremely humid, check the filter at least twice each month and clean it if necessary. Filters you are unable to clean or that are torn should be replaced.
Air conditioners have a drain that holds condensation. The line that carries this water can develop a moldy odor over time, but you can get rid of it using household detergent. The drain line usually is a plastic tube inside the unit; you can see the water draining out. Remove the line and flush it with a mixture of 1 part bleach and 3 parts water. Let the line dry, then replace it on the air conditioner. Clean the line once each month to kill algae and mold that may be growing inside and to eliminate the smell.
Near the heat exchange on your air conditioning unit, you should find a drip pan, or a small tray. The water collected inside the pan can be a breeding ground for bacteria, which develops a foul odor. Remove the pan and clean it with hot soapy water. Dry the pan and replace it.
Sometimes debris from outside or dust from inside your home falls into the top of the air conditioning unit. Open the top of the air conditioner and look inside using a flashlight. If there are bits of debris or dust, remove them, then spray a foaming coil cleaner inside the unit. Let the cleaner sit to remove grease and dirt, then rinse away the foam. Replace the top when the inside of the unit is dry. This should be done monthly to keep odors away.