Filtering posts by category name based on page’s slug

  1. You are missing an endwhile;.
  2. Since you are trying to concatenate, you need to use get_* for title, permalink and content.
  3. You are using $page_slug here and $post_slug there. Just use one and the same variable. 😉
  4. Put the condition of the while loop inside brackets.

See updated code:

global $post;
$page_slug = $post->post_name;
$args = array(
    'category_name' => $page_slug
);
$category_query = new WP_Query($args);

if ($category_query->have_posts()) {
    while ($category_query->have_posts()) {
        $category_query->the_post();
        ?>
        <h2 class="entry-title" itemprop="headline"><a href="https://wordpress.stackexchange.com/questions/127189/<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <div class="entry-content" itemprop="text"><?php the_content(); ?></div>
        <?php
    }
} else {
    ?>
    <h3>No posts found under "<?php echo $page_slug; ?>"</h3>
    <?php
}
wp_reset_postdata();