We use 'a' when we are refering to a type of thing or person, but don't know which one for certain.
We use 'the' when we know to what we are refering.
"Fred, what's new?"
"Hi Tom. We bought a dog." ['a' dog, because we don't know which one up to this point. It could be any dog.]
"What kind is the dog?" ['the' dog, because now we know which dog we are refering to - the dog that Fred bought."]
"The dog is a poodle." ['the' dog, because we still know which dog we are talking about.]
If Fred and Tom had talked about buying a particular dog earlier and Tom knew that Fred was going to buy a particular dog - the poodle in this case - the sentence might have been:
"Hi Fred. Did you buy the dog you were talking about. The poodle?" [Again, we use 'the' because we know definitely which dog."
"Do you own a dog?" = "Do you own any dog?" [We don't know which dog - we are trying to find out.]