Tannic acid was one of the first developers for silver halide emulsions.

What happens is that developers contain a weak reducing agent which changes the (exposed) silver halides to metallic silver. There are a lot of chemicals that work; but many of them work a little too well and will reduce the unexposed halides as well.

Some of the stuff in coffee just happens to have reduction potentials inside the useful window.