Its the UA (User Agent) default stylesheet which sets a set of rules for all elements (all elements are display:inline by default) and for some elements the UA will add margins or padding or both. That’s why reset (or normalise) stylesheets cropped up so that all browsers could start on an even keel.
Have you never noticed the default margins on a p tag or an h1 tag or the default bullet on a list. These are all set in the UA stylesheet,
The body element generally has an 8px margin by default in some browsers so you need to control it in your own stylesheet instead and set it to what you want. Historically some browsers used padding and some used margin and some applied them to the html element instead of body. Therefore I always include this in my default stylesheet.