Bullshit to those that say animals don't show emotions or other human characteristics.
As for the question at hand, my dog is an excellent swimmer and would save the stranger.
-----
You mean you don't have to train a human child to distinguish between right and wrong? You must have some amazing kids.
Sure animals show emotions and human characteristics, but that's because we teach them to and they do it as a response for some reward, not because they want to do good for the sake of doing good.
As far as people teaching their kids, who taught the parents? Depending on your beliefs humans either evolved to have a superior ability to do good, or were given/taught it from God. Either way, humans have a superior ability to do good then do animals (the species as a whole. there are obviously individuals who break the rule.)
Saving your pet over a human is a purely selfish act in every way. You are saving that animal b/c you are connected to it, not because it is the right thing to do. It's likely the animal won't do any real god in the world other than give you (and your family) joy. Another person as the ability to give jobs, give charity, do acts of kindness, raise a family, give birth to their own kids who can do all the aforementioned good things.