Here is a very short story about history and evolution of XML. A kind of markup language was in use in publishing industry long before the formal markup we know these days. The text that needs to be marked as bold on paper was marked as 'B', so that that text can be made bold on publishing.
IBM created a first formal markup language in 1960. It was known as GML (Generalized Markup Language). SGML has come from this and it became standard for many future different markup languages.
Scientists at CERN need to exchange research papers and refer many papers on regular basis. Working this way and managing all the papers was not easy those days. You can understand this. Great Tim Berners-Lee and few others realize that he can create a simple document structure that will allow to link documents. They also thought of document structure that would help browser how document would be viewed. This is called HTML. HTML has retained all the simple features of SGML.
HTML was good for static text, it solved presentational, and layout aspects. It was not good as metadata and exchanging data in structured manner. It was not adequate for data-oriented nature of information exchange.
SGML (Standard General Markup Language) was complex for Internet. SGML needed DTD that can specify individual industry need. This DTD and various optional features of SGML made SGML complex for internet. Flexible nature of SGML made its rule fuzzy and browser vendors started to make it suitable for their own need made it inflexible for Internet.
For e-commerce and data exchange there was a standard called EDI was in use. However, this was costly and very complex. Its use required specific dependent technology for each different kind of businesses.
XML was formed out of SGML for solving all the above problems. Earlier experiences with all mentioned technologies available at that time made inventing XML easier. The requirement for a kind of technology was clear by this time after facing troubles from various technologies mentioned above. It was taken the best feature of SGML. It was designed for Internet and has the support of Standard body W3C. It was originally named Web SGML and later named XML (Extensible Markup Language).