Communication is a basic need for almost any being. Either for amazon’s ants transmitting chemical messages to announce presence of food, or for primitive humans painting caves to tell stories about hunting or register their cattle property.
Then, as society growth and evolved into more complex relationships (tribes to nations), settlements (villages to cities), housing (hut to houses, buildings or palaces), and so on, the need to register and share also increased. In the visual aspect, the using of paper (or its ancestors: leather and papyrus) gives the painting or writing the ability to be mobile and replicable.
Of course the more obvious use of drawings are the representation of things, such as animals, people, machines or buildings, inherently linked to art, literacy, engineering, sciences, architecture, religious depictions and historic or politic topics. Appart from these, there started the need to associate information and drawing for use in such documents like genealogy trees, maybe the first kind of diagrams.
Again, centuries passed until the first formal diagrams were conceived. In turn, these more elaborated diagrams, were result of more sophisticated management techniques and science advances, mainly in the Scientific and the Industrial revolutions.