Kl is the feminine form of klam ("black, dark coloured"). Kl also shares the meaning of "time" or "the fullness of time" with the masculine noun "kla"and by extension, time as "changing aspect of nature that bring things to life or death." Other names include Klartri ("the black night"), and Klik ("the black one").
The homonymous kla, "appointed time", which depending on context can mean "death", is distinct from kla "black", but became associated through popular etymology. The association is seen in a passage from the Mahbhrata, depicting a female figure who carries away the spirits of slain warriors and animals. She is called klartri (which Thomas Coburn, a historian of Sanskrit Goddess literature, translates as "night of death") and also kl (which, as Coburn notes, can be read here either as a proper name or as a description "the black one"). Kl is also the feminine form of Kla, an epithet of Shiva, and thus the consort of Shiva.
Hugh Urban notes that although the word Kl appears as early as the Atharva Veda, the first use of it as a proper name is in the Kathaka Grhya Sutra (19.7). Kali appears in the Mundaka Upanishad (section 1, chapter 2, verse 4) not explicitly as a goddess, but as the black tongue of the seven flickering tongues of Agni, the Hindu god of fire.
According to David Kinsley, Kli is first mentioned in Hindu tradition as a distinct goddess around 600 CE, and these texts "usually place her on the periphery of Hindu society or on the battlefield." She is often regarded as the Shakti of Shiva, and is closely associated with him in various Puranas.
Her most well known appearance on the battlefield is in the sixth century Devi Mahatmyam. The deity of the first chapter of Devi Mahatmyam is Mahakali, who appears from the body of sleeping Vishnu as goddess Yoga Nidra to wake him up in order to protect Bramha and the World from two demons Madhu and Kaitabha. When Vishnu woke up he started a war against the two demons. After a long battle with lord Vishnu when the two demons were undefeated Mahakali took the form of Mahamaya to enchant the two asuras. When Madhu and Kaitabha were enchanted by Mahakali, Vishnu killed them. In the later chapters the story of two demons can be found who were destroyed by Kali. Chanda and Munda attack the goddess Durga. Durga responds with such anger that her face turns dark and Kali appears out of her forehead. Kali's appearance is black, gaunt with sunken eyes, and wearing a tiger skin and a garland of human heads. She immediately defeats the two demons. Later in the same battle, the demon Raktabija is undefeated because of his ability to reproduce himself from every drop of his blood that reaches the ground. Countless Raktabija clones appear on the battlefield. Kali eventually defeats him by sucking his blood before it can reach the ground, and eating the numerous clones. Kinsley writes that Kali represents "Durga's personified wrath, her embodied fury."
Other origin stories involve Parvati and Shiva. Parvati is typically portrayed as a benign and friendly goddess. The Linga Purana describes Shiva asking Parvati to defeat the demon Daruka, who received a boon that would only allow a female to kill him. Parvati merges with Shiva's body, reappearing as Kali to defeat Daruka and his armies. Her bloodlust gets out of control, only calming when Shiva intervenes. The Vamana Purana has a different version of Kali's relationship with Parvati. When Shiva addresses Parvati as Kali, "the black one," she is greatly offended. Parvati performs austerities to lose her dark complexion and becomes Gauri, the golden one. Her dark sheath becomes Kausiki, who while enraged, creates Kali. Regarding the relationship between Kali, Parvati, and Shiva, Kinsley writes that:
In relation to Siva, she [Kali] appears to play the opposite role from that of Parvati. Parvati calms Siva, counterbalancing his antisocial or destructive tendencies; she brings him within the sphere of domesticity and with her soft glances urges him to moderate the destructive aspects of his tandava dance. Kali is Shiva's "other wife," as it were, provoking him and encouraging him in his mad, antisocial, disruptive habits. It is never Kali who tames Siva, but Siva who must calm Kali.