Drupal 8 reset session each request
With @4k4's suggestion, I found the problem. After each request has a ajax request. The request has route name is quickedit.attachments and method post. So I edited code like that:

public function setSession(Event $event) {
    $route_name = \Drupal::routeMatch()-&gt;getRouteName();
    if (!$event-&gt;getRequest()-&gt;isXmlHttpRequest()) {
      if ($route_name == 'view.frontpage.page_1') {
        $_SESSION['page'] = 'Home page';
      }
      else {
        $_SESSION['page'] = 'Other page';
      }
    }
  }


Now it's working good. Thanks!