add category to posts with tag wordpress

This is just an example to get all posts in the category transportation with the tag car :

$args = array(
'post_type'=>'post',
'tax_query' => array(
    'relation' => 'AND',
    array(
        'taxonomy' => 'category',
        'field'    => 'slug',
        'terms'    => array( 'transportation' ),
    ),
    array(
        'taxonomy' => 'tag',
        'field'    => 'slug',
        'terms'    => array( 'car' ),
        'operator' => 'IN',
    ),
);
$posts = get_posts($args);

EDIT : for a simple tax_query

'tax_query' => array(
    array(
        'taxonomy' => 'tag',
        'field' => 'slug',
        'terms' => 'car'
    )
)

You can grab more details and it for your case here https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

This will not get the posts tag ‘car’ and add category ‘transportation’ to them, but you need first to get posts.
With this result you can loop through it and use wp_set_object_terms( $object_id, $terms, $taxonomy, $append ); in this loop to add your category to the tagged posts.

foreach($posts as $post){
    $append = true; // If true, terms will be appended to the object. If false, terms will replace existing terms
    // make some verif that's better
    wp_set_object_terms($post->ID, 'transportation', 'category', $append);
}

the best it to read https://codex.wordpress.org/Function_Reference/wp_set_object_terms

I hope you get it !