A damp environment and mold can cause a musty smell in your carpet. Water leaks often become the cause of the damp environment around your carpet, and it is important for you to keep the carpet dry if you want to remove the smell. A musty smell can also happen after you clean the carpet using a detergent or carpet shampooer when you didn’t dry it well.