To mean working hard?
Dogs just lie around and nap. That's not working hard...
In olden days, the two sawyers who worked on a tree sawing planks were the top-dog and the under-dog. A dog in those days was a manual worker. (Emphasis mine)
Perhaps the expression could also have come from a comparison with a "manual worker".
I believe the term comes from herding dogs. I'm not a farmer, but from what I hear they work their little canine tails off to help with the herding.
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?