Adding active/current class to get_terms list

Run a conditional check in the foreach loop using is_category($term-name)

Assign a class variable to active if it’s the same as $term->name

$terms = get_terms( 'category' );
echo '<ul>';
foreach ( $terms as $term ) {
    $class = ( is_category( $term->name ) ) ? 'active' : ''; // assign this class if we're on the same category page as $term->name
    echo '<li><a href="' . get_term_link( $term ) . '" class="' . $class . '">' . $term->name . '</a></li>';
}
echo '</ul>';