How do I return a Twig template inside the build method of a block class?
In your modules *.module file you must implement hook_theme() like this:

/**
 * Implements hook_theme().
 */
function fax_theme() {
  return [
    'fax_custom_theme' =&gt; [
      'variables' =&gt; [
        'test' =&gt; NULL, # Makes the {{ test }} variable available in the template.
      ],
    ],
  ];
}


Then you can return this in your block:

$test = 'My custom variable';
return [
  '#theme' =&gt; 'fax_custom_theme',
  '#test' =&gt; $test, # Assigns a value to the {{ test }} variable.
];


This makes the {{ test }} variable available in your theme.

Then add your template to the module under fax/templates/fax-custom-theme.html.twig.

Template names are using dashes instead of undercores.