Only Show One Category Name Per Post

You need to pass the category ID into get_category_link()

<a href="https://wordpress.stackexchange.com/questions/244678/<?php echo esc_url( get_category_link( $category[0]->term_id ) ); ?>"><?php echo $category[0]->cat_name; ?></a>

Here’s the whole thing put together

<?php
$query = new WP_Query( array(
  'posts_per_page'      => 2,
  'categories_per_page' => 1,
) );

while ( $query->have_posts() ) : $query->the_post(); ?>

  <li><a href="https://wordpress.stackexchange.com/questions/244678/<?php the_permalink(); ?>"><?php the_title(); ?></a></li>

  <?php
  $category = get_the_category();

  if ( ! empty( $category ) ) {
  ?>
    <a href="https://wordpress.stackexchange.com/questions/244678/<?php echo esc_url( get_category_link( $category[0]->term_id ) ); ?>"><?php echo $category[0]->cat_name; ?></a>
  <?php
  }

endwhile;
?>