There’s no evidence that we have found of the actual hanging of any dog nor of the actual appearance of any person who had committed such an act.
So the only inference that can be drawn is that someone gifted with high imaginative powers, about three centuries ago, figured that a dog, if hung, would have a cringing abject demeanor, or that the person capable of hanging it would have a contemptible sneaky aspect, and thus applied the term to one of such character or appearance.