If your theme is any good it will have the wp_head
hook in header.php
. In your child theme’s functions.php
you can add an action to include anything you want. Like this:
add_action ('wp_head','wpse359909_add_gtm');
function wpse359909_add_gtm () {
echo 'whatever code you want to add';
}