Change this:
echo $category->cat_name
To this:
echo $category->cat_slug
A better way would probably be to use:
$cat = get_the_category();
$cat_link = get_term_link( $cat );
That will have $cat_link
as the full permalink.
echo '<a href="' . $cat_link . '">' . $cat->cat_name . '</a>';
Using your code above:
<a href="<?php
$cat = get_the_category();
echo get_term_link( $cat );
?>">
Personally, I try to avoid intermixing things like that as it gets to be a pain to read, but the above should replace what you have.
Better would be
<?php
$cat = get_the_category();
$cat_link = get_term_link( $cat );
echo <<<HTML
<a href="{$cat_link}">{$cat->cat_name}</a>
HTML;
?>
That would also replace what you wrote.