Kali is thought to have originated as a tribal goddess indigenous to one of India's inaccessible mountainous regions. The Matsyapurana gives her place of origin as Mount Kalanjara in north central India, east of the Indus Valley floodplain. But owing to the late date of the Puranas' composition, this evidence regarding Kali's place of origin cannot be taken as particularly reliable.
At least thousand years before the Matsyapurana, the name of Kali first appears in Sanskrit literature between the eighth and fifth centuries BCE. The reference, in Mundakopanishad 1.2.4, names Kali as one of the seven quivering tongues of the fire god Agni, whose flames devour sacrificial oblations and transmit them to the gods. The verse characterizes Agni's seven tongues as black, terrifying, swift as thought, intensely red, smoky colored, sparkling, and radiant. Significantly, the first two adjectives -- kali and karali -- "black" and "terrifying," recur in later texts to describe the horrific aspect of the goddess. Karali additionally means "having a gaping mouth and protruding teeth." This verse scarcely suffices to confirm that Kali was a personified goddess during the age of the Upanishads, but it is noteworthy that the adjective that became her name was used to characterize an aspect of the fire god's power.
Kali first appears unequivocally as a goddess in the Kathaka Grihyasutra, a ritualistic text that names her in a list of Vedic deities to be invoked with offerings of perfume during the marriage ceremony. Unfortunately, the text reveals nothing more about her.
During the epic period, some time after the fifth century BCE, Kali emerges better defined in an episode of the Mahabharata. When the camp of the heroic Pandava brothers is attacked one night by the sword-wielding Asvatthaman, his deadly assault is seen as the work of "Kali of bloody mouth and eyes, smeared with blood and adorned with garlands, her garment reddened, -- holding noose in hand -- binding men and horses and elephants with her terrible snares of death" (Mahabharata 10.8.64-65). Although the passage goes on to describe the slaughter as an act of human warfare, it makes clear that the fierce goddess is ultimately the agent of death who carries off those who are slain.
Kali next appears in the sacred literature during the Puranic age, when new theistic devotional sects displaced the older Brahmanical form of Hinduism. In the fourth and fifth centuries CE the Puranas were written to glorify the great deities Vishnu, Shiva and the Devi -- the Goddess -- as well as lesser gods. One such Purana, the Markandeya, contains within it the foundational text of all subsequent Hindu Goddess religion. This book within a book is known as the Devimahatmya, the Shri Durga Saptashati, or the Chandi.
The Devimahatmya's seventh chapter describes Kali springing forth from the furrowed brow of the goddess Durga in order to slay the demons Chanda and Munda. Here, Kali's horrific form has black, loosely hanging, emaciated flesh that barely conceals her angular bones. Gleaming white fangs protrude from her gaping, blood-stained mouth, framing her lolling red tongue. Sunken, reddened eyes peer out from her black face. She is clad in a tiger's skin and carries a khatvanga, a skull-topped staff traditionally associated with tribal shamans and magicians. The khatvanga is a clear reminder of Kali's origin among fierce, aboriginal peoples. In the ensuing battle, much attention is placed on her gaping mouth and gnashing teeth, which devour the demon hordes. At one point Munda hurls thousands of discusses at her, but they enter her mouth "as so many solar orbs vanishing into the denseness of a cloud" (Devimahatmya 7.18). With its cosmic allusion, this passage reveals Kali as the abstraction of primal energy and suggests the underlying connection between the black goddess and Kala ('time'), an epithet of Shiva. Kali is the inherent power of ever-turning time, the relentless devourer that brings all created things to an end. Even the gods are said to have their origin and dissolution in her.
The eighth chapter of the Devimahatmya paints an even more gruesome portrait. Having slain Chanda and Munda, Kali is now called Chamunda, and she faces an infinitely more powerful adversary in the demon named Raktabija. Whenever a drop of his blood falls to earth, an identical demon springs up. When utter terror seizes the gods, Durga merely laughs and instructs Kali to drink in the drops of blood. While Durga assaults Raktabija so that his blood runs copiously, Kali avidly laps it up. The demons who spring into being from the flow perish between her gnashing teeth until Raktabija topples drained and lifeless to the ground.