XML is used to mark up data in a way that is easily readable by both machines and humans.
It is used for so many things, it's sometimes called the "baking soda" of the web. Its syntax and schema are descended from the same markup language that spawned HTML, and it has cross-bred with HTML to produce XHTML, the strictest standard markup language for publishing web pages.
But it's not just for publishing on the web. It's predominantly used as a carrier format for data. The majority of public APIs offer XML as their output. Many systems employ XML to mark up configuration files, or human-editable data that is intended for consumption by a machine. There is hardly a computer system in existence that doesn't use XML in some way.
As with any language it has its pros and cons, so anyone designing a system needs to understand those and decide whether to use XML, or some other data carrier format like JSON, INI, CSV, Protocol Buffers, YAML, WDDX, Thrift, etc.