I’ve figured this out. I changed return value to Term ID.
To display category name, I used this:
<?php $term = get_term(get_sub_field('category'), 'category'); ?>
<h2><?php echo $term->name; ?></h2>
Then if you need to display the ID as well like I did, you just use this:
<?php echo $term->term_id; ?>