JQuery needs to be defined in , but Gravity Forms is defining it in the

A bit of context:

Gravity Forms itself does not contain and does not add jQuery to the site. jQuery is included with WordPress and when it is needed by a plugin or a theme, you simply tell WP that jQuery is needed on the page and it will take care of making it available.

Because of this, there is not a problem with adding it several times. It can be requested in multiple places (such as by multiple functions or plugins) but WP knows to add it only once on the page.

Regarding your specific use case:

When you are installing Google Tag Manager, are you placing a script in the head of the page using wp_enqueue_script? If so, as @Andy already mentioned in the above comment, when you enqueue the script, you can specify jQuery as a dependency for that script and WP will take care of making it available on the page before your script needs it:

function my_theme_add_gtm_script() {
    wp_enqueue_script('google-track-manager', get_template_directory_uri() . '/assets/js/gtm.js', array('jquery'), false, false);
}
add_action('wp_enqueue_scripts', 'my_theme_add_gtm_script');

You can see more information about the script enqueue function on the Code Reference page: wp_enqueue_script. You can also see example implementation codes there, at the bottom of the page, in the Notes section.

The dependency is specified as the 3rd parameter and is an array containing a list of script handle names that your script is dependent upon. You can specify jQuery as a dependency by entering array('jquery').

The 5th parameter specifies if your script should be added in the page footer (before the closing of the </body> tag). By default, this parameter is false and the script is added in the head but I have included it for clarity.

The file src is specified as the 2nd parameter and you can build that depending on your specific needs (if you are calling this from a theme, from a plugin, your folder structure, etc). I have entered an example src for a theme.

Alternative option:

If you are not using wp_enqueue_script and cannot specify jQuery as a dependency, but still want to tell WP to include jQuery in the head:

(By default, jQuery is added in the <head> but a plugin might have changed that default behavior and requested it in the footer.)

The following thread discusses a few techniques about how to change the location of jQuery through code. It talks about how to change it to the footer but the same ideas apply about changing it to the head as well: Enqueue core jQuery in the footer?