Pagination on and tag.php not working

One reason this probably isn’t working is that you’re not defining $nameTerm anywhere, so you’re probably not even querying the correct posts for the current tag.

The main reason though is that tag.php should not have a custom query. The main template files in WordPress should be using The Loop to display posts. WordPress has already queried the correct posts.

<?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
        POST CONTENT
    <?php endwhile; ?>

    <div class="pagination">
        <?php if ( function_exists( 'wp_pagenavi' ) ) { wp_pagenavi(); } ?>
    </div>
<?php endif; ?>

This is by far the most common development mistake I see here. If you’re learning how to create a theme it’s important to follow the official documentation, refer to the default Twenty X themes (eg. Twenty Twenty One), and find a reputable tutorial. If you jump straight to searching for “how to query posts by tag”, for example, without checking if that’s even something you need to do for the tag.php template, then you’re going to get solutions for the wrong problem.