Black hairy tongue is caused by the extension of the filiform papillae of the tongue as a result of increased cornification (hyperkeratosis).
Usually the ends of the papillae get rubbed away by food but sometimes they grow much longer than normal, making the tongue look furry. The extra tissue can get stained by food or tobacco and become yellowish brown or black.
Hyperkeratosis can be triggered by common irritants including tar, drugs (antibiotics) or intensive use of mouthwashes. In addition, a niacin deficiency is discussed as cause. The diet seems to play a role in the development of hairy tongue, too. The staining is probably caused by food or bacterias.