Query & the_content() is showing in the header

The main query runs before the template is loaded. WordPress knows what template to load based on the results of that query.

If you want to insert an additional query into the content area, either create a shortcode, or add a filter on the_content and do your page check/query output there.