It is a sedan with a trunk for structural reasons - the glass roof gets the head room, and the cross beam had to be located at the base of the window.
The window blocks most of the heat and UV.
Here are lots more details:
Tesla Model 3 Tweet Storm By Musk Reveals Tons Of New Details