WordPress showing wrong category name

As far a I can understand you need to display the category name for the current page when viewing a category page.

You can make use of the query variables to retrieve the category name, for example:

$category = get_queried_object('cat'); 
echo $category->name;

EDIT

A global check to see what is returned by the main query for a specific page/template, you can do a var_dump of the main query global, $wp_query. Add the following code inside your template outside of the loop

?><pre><?php var_dump($wp_query); ?></pre><?php 

To check which query variables are available on a template/page, you can do a var_dump of get_queried_object()

$queried_object = get_queried_object();
 var_dump( $queried_object );

Here is also a list of all query variables