XML (Extensible Markup Language) is a markup language used to structure documents, using a predefined set of rules. XML is basically a common language used between programs to communicate data, and InDesign uses XML to store text and grouped elements that comprise a layout.
InDesign XML helps make your documents more dynamic, customizable and easier to maintain. With XML in InDesign, you can quickly ensure consistency across multiple documents, and customize each document to fit their needs. XML also makes it easier to move data from one document to another.
XML can be used to create Books in InDesign, which are essentially collections of documents that all use the same information. Rather than entering data into every document individually, this data exists only in one place and is applied to the documents linked to the Book. The same goes for assets, such as images and logos.
XML can also be used for other tasks in InDesign, including changing formatting, adding automation features and creating counters.
If you're interested in learning more about XML and InDesign, Adobe's official documentation is a great place to start: https://helpx.adobe.com/in/indesign/using/working-xml.html