Because they don't understand spoken language but they do understand tone of voice. So if you say 'good boy' to your dog in a deep stern voice he will feel bad. If you say 'Bad boy' in a cutesy way his tail will wag.
Addendum Why do so many people's names end in a 'y' sound? like Judy Julie Andy Johnny Suzy etc etc?
Anthropomorphisising is a common human response to animals - people can talk in a 'baby' voice - as indeed they do to babies - because it generates a pleasing response, and there is no danger of feeling ridiculous. Ask the butchest man you know with kids the things he has said to his children as babies when there's no-one around, and watch him blush! We all do it - it's human nature.