How do I only render the main content without wrapping it with the theme or side blocks and menus?
There are two similar questions.

Problems creating a custom blank page with my custom module

How to output from custom module without rest of theme

You can use a symfony response or replace the page template with a blank twig in hook_theme().