I disagree with Conors answer.
Let's compare these two methods:
For GTM you need in the head-tag
<!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><!-- End Google Tag Manager (noscript) -->
and in body-tag
<script async>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
Use "async" to load that script (Google doesn't tell you)
For Analytics.js you only need in the body-tag
<!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-X"></script><script>window.dataLayer=window.dataLayer || []; function gtag(){dataLayer.push(arguments);}gtag('js', new Date()); gtag('config', 'UA-56544056-1');</script>
"async" here as well increases the performance.
Now test both options with Google Pagespeed Insight and the results will be better if you choose the second method. It's confusing, because the first method results in less traffic from Javascript, what should give you more points in Pagespeed Insight. Considering that and the fact that Google is pushing GTM, I guess the lower result by choosing the first method is unintended by Google. But there are other tools to measure page performance...
I'm wondering if other users can confirm this finding.
Cheers, Mathias