Solution 1:

Handbrake is probably not the best choice for this as it's so unfriendly and difficult to setup. The easiest way I've found is:

  1. Select one of the Matroska H.265 Presets
  2. Change Summary > Format to MP4 File
  3. Start encoding

The only issue is if your source video does not match one of the presets.

enter image description here

You might have more luck, and make your life easier with Half app ($9.99).

Apple's Compressor app (App Store link, not available for free) can do this easily: https://support.apple.com/en-gb/HT208238

  1. Select the setting in the batch area,
  2. Click Video in the Inspector, then click Change.
  3. Click the Compression Type pop-up, then choose HEVC from the list.

Using Compressor you can also create a self-contained HEVC droplet for easy drag-and-drop encoding.