Infections are the common culprit of a bad, usually bitter, taste. Teeth, gums, and other areas of the mouth and pharynx may be involved. Pain may or may not be present.
Some diseases cause a bad taste in mouth, or at least an odd taste. Diseases that affect the tissues of the mouth and throat are the most obvious: gum disease, tooth decay, cancers, bacterial infections and other conditions are included here. Some systemic diseases contribute to a mouth bad taste because of byproducts that get carried into the saliva or excreted in the breath. If you suspect that you have a medical problem, see your doctor or dentist immediately.
Again, some cases of mouth bad taste are simply caused by bad breath. Bacteria in the mouth that break down protein and produce sulfur molecules that you can smell on your breath, also produce byproducts that can be tasted. The taste of anaerobic bacteria and their byproducts is a rotten, unpleasant taste. Trapped food particles between the teeth, tooth decay, and gum disease all encourage the growth of these organisms and make the taste and smell worse. If you suspect that you have tooth decay or gum disease, see your dentist; if it's just uncomplicated bad breath, establish a personal oral hygiene routine and use a good mouthwash with other breath products to manage the condition.