To mean working hard?
Dogs just lie around and nap. That's not working hard...
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It only takes a minute to sign up.Sign up to join this community
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.