The answer to 'carpet smells bad' is that there are several common causes, including spills, pet accidents, mold/mildew, or simply built-up dirt and debris. Symptoms may include a musty, unpleasant odor that won't go away. Solutions can range from DIY cleaning to professional deep cleaning, depending on the severity of the issue.
For minor odors, you can try spot cleaning with a carpet cleaner, baking soda, or vinegar. More stubborn smells may require steam cleaning the entire carpet. If the odor is caused by mold or mildew, you'll likely need professional remediation to properly treat the problem and prevent it from recurring.