Why is my dishwasher causing the dishes to have an odor?
Dishwasher cleaners are available - I use this one every six months or so - it has a range of chemicals in it which get in around all the bits that might be moldy and gives them a good clean.

Once cleaned, the following tips I found over at wikihow will help prevent this in future:


Run the garbage disposal before starting the dishwasher. The dishwasher drains into the same pipe as your sink, so that drain must be clear.
Run a bit of hot water in your sink before running the dishwasher. You will get cleaner dishes if the water starts hot. You can collect the water you run and use it for watering plants or other purposes. Run the water until what comes out of the tap feels hot.
Make sure your water starts hot enough. Set the thermostat on your water heater to 120F (50C). Water that is cooler than this won't do a good job cleaning. Water that is hotter could scald.
Load your dishwasher properly, stacking items facing downward and inwards. Check that all the arms can spin freely before running the dishwasher.
Run full loads to conserve water and energy, but don't pack dishes too tightly. Dishwashers wash dishes by spraying water over them, so the water needs to be able to get to the dishes to clean them.
Don't wash containers with labels that could come loose. Scrape heavy debris and large particles off dishes before placing them in the dishwasher.
Don't pre-rinse too much. Dishwashers and detergents have both improved. If you haven't tried putting dishes in dirty lately, try it again. You may be pleasantly surprised.
Not all dishwasher detergents work the same. The next time you buy a new container of detergent, try a different brand and see if you get better results. Look for ratings and reviews, too. At the very least, favor powders and tablets over gels and liquids, and keep them dry and free of excess moisture prior to use.
Wash small items in the basket with your forks and knives so they don't slip through the racks and end up in the bottom. Some dishwashers even have enclosed baskets just for small items.
For dried-on gunk, get the area wet or spray the cleaner, then let it sit and dissolve for a few minutes before wiping. You'll save yourself a lot of scraping and scrubbing.