The DOM is how a browser represents a page in memory. It parses the HTML into a tree of nodes, with elements such as headings, paragraphs and links as branches, and exposes that tree to JavaScript. When a script adds, removes or edits a node, the visible page updates.
It matters for performance because everything the browser must do is tied to the size and shape of that tree. A very large DOM takes longer to build, style and lay out, and uses more memory. Plugins and page builders that wrap every element in many nested containers are common culprits, and PageSpeed Insights reports an oversized DOM as a diagnostic.
A common confusion is thinking the DOM is the same as the HTML source. The source is the text the server sent; the DOM is the live structure after parsing and after scripts have changed it. They can differ a lot on pages that build content with JavaScript. Example: viewing source shows an empty div, while the DOM inspector in dev tools shows the finished list of articles that a script inserted after loading.
Related: forced reflow, layout thrashing, plugin bloat, page builder, render-blocking