The gods were responsible for teaching humans how to write. Without their divine involvement, it would have been impossible for us, imperfect mortals, to develop such a valuable and powerful skill. This, and other similar explanations, was the way that most ancient societies accounted for the existence of writing.
Itzamná, the Mayan god and ruler of heaven, was the inventor of writing in Mesoamerica, just like Odin in Norse mythology was the god who invented the runes. Thoth, the Egyptian god of wisdom and scribe of the gods, was responsible for the invention of Egyptian hieroglyphs. The Greek god Hermes (the Roman Mercury), related to the Egyptian Thoth by some Greeks, was the creator of the Greek alphabet. Even those Greeks who had a more rational explanation for the origin of the alphabet relied on a legendary figure who although was no god, was still mythical: Cadmus, the founder and first king of Thebes according to Greek folklore (Herodotus, 5.58).