Are they machine washable?
They smell because they aren’t clean. If it’s moldy, use cleaning vinegar with acidity greater than 5%. 1 up cleaning vinegar to 1 cup water. I use regular vinegar for maintenance in every wash load and never ever get anything smelling moldy.
Wash them either at home or laundromat(might be better so it doesn't mess up your machine from weight/clean the washer after for next person please);take outside shake out loose dirt/hair then hose off add some soap(diluted with water easier to rinse out) rinse really well; can soak in tub(bath tub or big plastic tub) with vinegar if needed too just don't plug drain if t you use tub with dirt,hair,fibers from rug. sprinkle with baking soda
If the fibers are washable, it can be cleaned in your clean driveway (or on a clean tarp), using Woolite or another mild detergent (Ivory dish detergent used to work very well). Scrub it into the fibers using a long handled shop broom or your hands. Let set 15 minutes, then rinse well using warm water (if permitted), or cold water from a hose. Let dry in the sun, placed atop concrete blocks or similar for air circulation. Use a stand fan to hasten drying.
Mix a carpet cleaner with some Downey stoppables or other fragrance u like in spray bottle and go at it