The simplest method is to writeremove the header in a custom EventSubscriber which removes the header:
$response->headers->remove('X-Generator');
like in this example
See https://drupal.stackexchange.com/a/201297/47547
where you need to replace this line only for an example.