A theogony is an account of the origin and genealogy of the gods, and its very existence marks a particular kind of religious thought: one prepared to treat the gods themselves as having a history rather than as simply given.
Hesiod's Theogony, of about 700 BCE, is the term's source and the classic case. It begins with Chaos, then Gaia, Tartaros and Eros, and proceeds through generations, Ouranos and Gaia producing the Titans; Kronos castrating and displacing his father, then swallowing his own children; Zeus displacing Kronos after the Titanomachy, to the settled Olympian order. Succession by violence is its organising structure, and its conclusion is frankly political: the present order is the outcome of a struggle, and it is stable because Zeus won and has arranged things so that he cannot be displaced in turn.
That succession pattern provides one of the clearest cases of demonstrable transmission in the whole study of myth. The Hittite texts recovered at Hattusa in the twentieth century, and particularly the Song of Kumarbi, contain a very close parallel: a sequence of sky-gods displacing one another, including a castration episode, with Mesopotamian material lying behind it. The near-consensus is that Hesiod's succession myth reached Greece from the Near East by way of Anatolia and the Levant, and the discovery substantially changed how classicists understand the relation between Greek and Near Eastern religion.
Other theogonies are differently structured. The Enuma Elish combines theogony with cosmogony, since Marduk makes the world from Tiamat's body, and it exists to authorise Marduk's supremacy and with it Babylon's. Egyptian theologies at Heliopolis, Memphis and Hermopolis each derived the gods differently, and the coexistence of mutually incompatible accounts at different centres is normal in Egyptian religion rather than a problem within it. Norse material gives Ymir and the emergence of the first god from a primal cow's licking of salted ice. The Japanese Kojiki opens with a series of kami simply coming into being, before the generative pair Izanagi and Izanami.
Monotheistic traditions have no theogony by definition, and their polemic against polytheism frequently targets exactly this point: a god who was born is not ultimate, since something preceded him. Christian trinitarian theology consequently had to distinguish the eternal generation of the Son from any temporal begetting, and the Nicene formula, begotten of the Father before all worlds, begotten not made, is a precise statement of that distinction. Islam's Surah al-Ikhlas makes the same point more briefly still: he neither begets nor is begotten.