My guess is, since they eat coffee cherries, some farmer had his harvest ruined and washed the seeds out from the shit in desperation, just to get told it's the best coffee somebody has ever had.
You can squeeze the water out of elephant crap and drink it. Humans figured out fermentation a long time ago. This isn't too much of a stretch given humans also know that animal poop is usable in other ways agriculturally.
the story I heard (from an Indonesian dude) was the colonial plantations didn't allow locals to drink coffee. They noticed the civits only ate the ripest coffee berries... bla bla bla, shit coffee was the only choice and it was really good?