When an HTML document loads in a browser, it becomes a document object that represents the DOM tree. The document object is the root node that contains all other nodes and provides access to them through properties and methods from JavaScript. This allows JavaScript to dynamically change HTML elements, attributes, styles, add and remove nodes, and react to events. The DOM defines HTML elements as objects that have properties and methods that can be used to manipulate the document.