See if a post has a specified tag

You should wrap your condition with brackets according to PHP syntax:

if (has_tag('Cat', $post_id)) {
    $taganimal = "Cat";
}

If you need to check multiple tags you can use something like

foreach (['Cat', 'Dog'] as $animal) if (has_tag($animal, $post_id)) {
    $taganimal = $animal;
    break;
}

but it would find only the first tag listed in array in case the post has several of them.