its origin is ancient and refers to shit not "bad" and is used as such in many languages
kakka- is the reconstructed Proto-Indo-European root for the verb "to defecate"
I expect the etymology is similar.