Yes dogs do know their names.
It can take awhile for a dog to know their new name when you first give the dog a name.
If you can it's best to give a dog their name when they are a puppy and begin calling the puppy by their name and eventually they will know that when you call their name that you want them to come.
I can say my dogs name and he'll look up at me which tells me that he knows his name.
Also when I say my dogs name and tell him to come to me he does so as well.
The same with my cat when I say my cats name the cat knows it's name too and will come when I ask him too.
So yes dogs and cats and other animals will eventually learn their name.