Carpets can become dirty because of a variety of causes, including dirt, pet hair, and smoke. If the carpet is not clean, it can harbor bacteria that can cause it to smell bad, be it in the air or on the floor. Additionally, if the carpet is not dried properly, it can hold water and bacteria, which can cause it to become dirty and stinky.