Old English docga, a late, rare word used of a powerful breed of canine. It forced out Old English hund (the general Germanic and Indo-European word; see canine) by 16c. and subsequently was picked up in many continental languages (e.g. French dogue (16c.), Danish dogge), but the origin remains one of the great mysteries of English etymology.
Many expressions -- a dog's life (c.1600), go to the dogs (1610s), etc. -- reflect earlier hard use of the animals as hunting accessories, not pampered pets. In ancient times, "the dog" was the worst throw in dice (attested in Greek, Latin, and Sanskrit, where the word for "the lucky player" was literally "the dog-killer"), which plausibly explains the Greek word for "danger,"