Your clothes are supposed to come out of the dryer soft and smelling fresh. If your dryer stinks, then not only is doing laundry an unpleasant task, but the bad smell could cling to your clean clothes.
If your dryer has an unpleasant, earthy odor to it, then the issue is likely mold growing on the outside of it. If the bad smell is more like smoke, then you have lint built up inside your dryer. When the lint is heated while the dryer runs, it will emit a burning smell that can cause your laundry area to stink.
You can remove the musty smell of mold by getting rid of the mold. Add a half cup of bleach to a gallon of water. Using a sponge, wipe away the mold on the dryer. To get rid of the stink of smoke, remove all lint from your lint trap. You might need to purchase a tool to insert inside your dryer to remove any lint caught inside of it. You can find an appropriate tool at home improvement stores.
To prevent mold from returning, install an exhaust fan in your laundry area. This will remove moisture from the air and prevent the humid environment that mold needs to grow. Stop the burning smell from coming back by removing all lint from the lint trap every time you use your dryer.