It could be a few reasons, the dog could be scared, the dog could be excited about seeing the cat or the dog might want to attack. You can tell what the dog is thinking by his posture. The tail between the legs doesn't always say the dog is scared. Leash the dog up and if the cat goes near the dog and he walks away or hides behind something then he's scared. Barking doesn't mean aggression either. They could just want to play with the cat. If The dogs head is high it doesn't mean he wants to attack either, just like if it's low. If the dog starts showing teeth, take him away from the area fast. He might kill the cat or injure it and you can get in a heap load of trouble and the dog will be put down.