The Mahavidya are a group of ten goddesses, the ten different manifestatiosns of the devi Shakti, the divine mother, who guard the ten different directions. So let us understand how the ten Mahavidyas came to be...
Sati, daughter of king Daksha, a manasputra of Brahma, had married Shiva, against Daksha's wishes. Once, Daksha was to conduct a yagna, and had invited all the devas and other celestial beings except for Shiva.
In spite of not being invited l, Sati insisted on going. Shiva tried with all his might to convince her to not go as he knew the consequences that it would result in, and he was concerned about her. However, Sati did not listen to him.
In fact, she was even more angry at her husband that he considered her to be an ordinary woman, and not the mother of the universe!
To make him understand who she truly was, she assumed the form of Mahakali. This ferocious form as Kali made the mountains to shiver, started volcanic eruptions and made many other such natural calamities to take place.
Seeing this, Shiva tried to move away from her, but alas he couldn't. Sati had manifested herself in ten different forms to stand guard at the ten different directions, thus blocking the path of Shiva.
And this is how the Mahavidyas were born.