This is a very common complaint heard by waterproofers and mold workers.
When water enters a building from either a leak or thru a foundation leak the surrounding building materials may become wet. The resulting mildew (mold) smell is the actual growth of microbes. Most often the only recourse is removal of the wet materials. Consulting a waterproofing company that can determine the cause can of such a leak, and hopefully prevent another, but there is little that can be done to repair wet drywall, carpet or carpet padding.