Story of Barbarika is mentioned in detail in Kaumarika Khanda, Maheswara Khanda of Skanda Mahapurana.
Barbarika was son of Ghatotkacha and Kāmakaṭankaṭa. Gatotkacha was son of Hidambi and Pandava Bhima.
In city of Pragjyotisapura, there was Rakshasa Muru who was defence officer of Asura Naraka. Sri Krishna killed Narakasura and Mura. Muru's daughter, kāmakaṭankaṭa , fought with Sri Krishna as He killed her father. But kāmakaṭankaṭa was devotee of Goddess Kamakhya and Goddess Kamakhya suggested not to fight with Sri Krishna. Thereafter, she married Ghatotkacha.
Complete story of events that lead to their marriage are described in Chapter 59 and Chapter 60 of Kaumarika Khanda.
Birth of Barbarika is mentioned in Chapter 60 of Kaumarika Khanda.
ततो वनेषु चित्रेषु निम्नगापुलिनेषु च ।
रेमे सह तया
भैमिर्मन्दोदर्येव रावणः ॥ ६०-६१
61.Thereafter, the son of Bhima sported with her in the forests of variegated colours and the banks of rivers like Ravana along with
एवं विक्रीडितस्तस्य गर्भो जज्ञे महाद्युतेः ।
हैडिम्भैराक्षसव्याघ्राद्बालसूर्यसमप्रभः ॥ ६०-६२
62.Even as the son of Hidambi, a tiger among Raksasas, (a leader) of great lustre was sporting about thus, a son was born to him. He had
the lustre of the rising sun.
स जातमात्रो ववृधे क्षणाद्यौवनगोऽभवत् ।
दीर्घलोचनः ॥ ६०-६३
ऊर्ध्वकेशश्चोर्ध्वरोमा पितरौप्रणतोऽब्रवीत् ।
युवांचोभौजातस्यपितरौगुरू ॥ ६०-६४
भवद्भ्यांदत्तमिच्छामिअभिधानंयथात्मनः ॥ ६०-६५
अतः परंतु यच्छ्रेयः कर्तव्यंप्रोन्नतिप्रदम् ।
भैमिस्तमालिङ्ग्य पुत्रं वचनमब्रवीत् ॥ ६०-६६
63-66. As soon as he was born, he increased in size. In a moment he
became a young man. He had the lustre of a blue cloud. His face
resembled a pot. He had long eyes. His hair on the head as well as on
the body rose up. He bowed down to his parents and said: “I bow down
to both of you. Parents are the preceptors of a person born. I shall
become free from the indebtedness to you by always doing what is
pleasing to you. I wish to have a name given by you two. Thereafter
what is conducive to welfare and prosperity should be performed.'
Thereupon the son of Bhima embraced his son and spoke these words:
कुलस्याऽऽनन्दवर्धनः ॥ ६०-६७
श्रेयश्च ते यत्परमं दृढं च तत्कीर्त्यते बहुधा विप्रमुख्यैः ।
प्रक्ष्यावहे तद्यदुवंशनाथं गत्वा पुरीं द्वारकां वासुदेवम् ॥ ६०-६८
67-68. “Since you have the hair like that of a Barbara, you will be
named Barbarika, O mighty-armed one, You will increase the delight
of the family. What is conducive to your welfare is glorified by the
leading Brahmanas in various ways. Therefore, we shall go to the city
of Dvaraka and ask Vasudeva, the Lord of the race of Yadu.'
Sri Krishna blessed the boy and taught him Kshatriya Dharma. As per suggestions of Krishna, Barbarika pleased various forms of Mother Goddess. Barbarika helped Brahmana Vijaya in performing Ganeswara Homa and Devas granted him the sacred ash obtained in Homam, which is mentioned in detail in Chapter 61 and Chapter 63.
Thereafter, Barbarika met Bhima and other Pandavas at Mahi Sagara Sangama, as described in Chapter 64.
When 13th year of Pandavas Vanavasa was over, various kings gathered and were discussing stategies and prowess of each other. When there were discussing time limit of each king to kill enemies (within how much time a king alone can kill all enemies) Barbarika said he would kill everyone in a Muhurta. Chapter 66 describes it in detail.
इत्युक्तो वासुदेवेन सर्वभूतेश्वरेण च ।
नानाभूषणभूषितः ॥ ६६-३५
घटास्यो घटहासश्चऊर्ध्वकेशोऽतिदीप्तिमान् ।
विद्युदक्षोवायुजवोयश्चेच्छेन्नाशयेज्जगत् ॥ ६६-३६
देवीदत्तातुलबलो बर्बरीकोऽभ्यभाषत ।
यदि वो मानसं वीरा उपायस्य
प्रदर्शने ॥ ६६-३७
तदहं दर्शयाम्येष पश्यध्वं सहकेशवाः ।
सन्दधे विशिखं त्वरन् ।
निःशल्यं चाऽपि सम्पूर्णं सिन्दूराभेण
भस्मना ॥ ६६-३८
आकर्णमाकृष्य च तं मुमोच
मुखादथोद्भूतमभूच्च भस्म ॥ ६६-३९
सेनाद्वये तच्च पपात शीघ्रं यस्यैव यत्राऽस्ति च मृत्युर्मम । ६६-४० (a)
35-40a. On being asked thus by Vasudeva, the Lord of all living
beings, Barbarika spoke out. He had the chest like a lion. He
resembled a huge mountain. He was bedecked in different kinds of
ornaments. His face resembled a pot. The sound of his laughter
resembled the sound from a pot. The hair on his head stood up. He had
great refulgence. His eyes shone like lightning streaks. He had the
velocity of the wind. If he wished he could destroy the universe. He
had unparalleled strength granted by the goddess. He spoke out thus,
“O warriors, if you are inclined to see the means (to be) used, I
shall exhibit it. All of you together with Kesava witness it.'
After saying thus he strung his bow and hurriedly fitted the arrow
thereto. The entire portion of the dart was filled with ash resembling
saffron. The ash fell on the soldiers of both the armies exactly on
the vulnerable spot. (If they were hit there they would die
सर्वरोमसु भीष्मस्य कण्ठे राधेयद्रोणयोः ॥ ६६-४० (b)
ऊरौ दुर्योधनस्याऽपि शल्यस्याऽपिच वक्षसि ।
कण्ठे च शकुनेर्दीप्तं
भगदत्तस्यचापतत् ॥ ६६-४१
कृष्णस्य पादतलके कण्ठे द्रुपदमत्स्ययोः ।
कण्थे सेनापतेस्तथा ॥ ६६-४२
पपात रक्तं तद्भस्म यत्र येषां च मर्मच ।
केवलं चैव पाण्डूनां
कृपद्रौण्योश्च नास्पृशत् ॥ ६६-४३
40b-43. The ash fell on the hair of Bhisma; on the neck of Karna and
Drona; on the thigh of Duryodhana; on the chest of Salya; the
brilliant ash fell on the necks of Sakuni and Bhagadatta; on the sole
of the foot of Krsna; on the necks of Drupada and Matsya; on the hip
of Sikhandin; on the neck of the commander-in-chief of the army
(Dhrstadyumna). The red ash fell on the vulnerable spot of everyone.
But the ash did not touch the Pandavas, Krpa and Asvatthama.
इति कृत्वा ततो भूयो बर्बरीकोऽभ्यभाषत ।
दृष्टं भवद्भिरेवं यन्मया
मर्म निरीक्षितम् ॥ ६६-४४
अधुना पातयिष्यामि मर्मस्वेषां शिताञ्छरान् ।
देवीदत्तानमोघाख्यान्यैर्मरिष्यन्त्यमी क्षणात् ॥ ६६-४५
शपथावः स्वधर्मस्यशस्त्रं ग्राह्यं न वः क्वचित् ।
मुहूर्तात्पातयिष्यामि शत्रुनेताञ्छितैः शरैः ॥ ६६-४६
44-46. After doing thus, Barbarika spoke once again: “Was this noticed
by you all how the vulnerable spot was located by me? Now I shall
discharge sharp arrows on the vulnerable spots of these, the arrows
that will never fail, the arrows that the goddess granted me.
Thereby, they will die in a moment. There is a solemn oath on the
Svadharma-your own Dharma. No weapon should be taken up by any of you.
I shall make these enemies fall down (dead) within a short while by
means of these sharp arrows.'
After uttering these words by Barbarika, Krishna immediately beheaded Barbarika. When everyone was awestruck, 14 Goddesses appeared and explained the reason for beheading.
Before incarnation of Krishna, all Devas went to abode of Lord Vishnu to save Earth from Rakshas. So, Lord Vishnu decided to incarnate as krishna. But a Yakhsa leader named Suryavarchas said he alone would kill all Rakshasas and there would be no need for Vishnu's incarnation. Brahma infuriated at his arrogance and cursed yaksha leader to get killed by Vishnu's incarnation Krishna.
सूर्यवर्चेति यक्षेन्द्रश्चतुराशीतिकोटिपः ।
किमर्थं मानुषे लोके
भवद्भिर्जन्म कार्यते ॥ ६६-५९
मयि तिष्ठति दोषाणामनेकानां महास्पदे ।
सर्वे भवन्तो मोदन्तु
स्वर्गेषु सहविष्णुना ॥ ६६-६०
अहमेकोऽवतीर्यैतान् हनिष्यामि भुवोभरान् ।
वैसन्तिचेज्जन्मप्राप्स्यथ ॥ ६६-६१
In the meantime, a Yaksa leader named Suryavarcas, lord of
eighty-four crores, lifted his hand and spoke loudly: “What for do you
promise to take birth in the human world which is a receptacle of many
defects (and that too) while I am alive? All of you may rejoice in the
heavenly worlds along with Visnu, I alone shall incarnate and kill
these people who become burden to the Earth. There is a solemn oath on
your Dharma, if you take up birth.”
इत्युक्तवचने ब्रह्मा क्रुद्धस्तं समभाषत ।
सर्वदेवानामविषह्यं महाभरम् ॥ ६६-६२
स्वसाध्यं ब्रूषे मोहात्त्वं शापयोग्योऽसि बालिश ।
स्वीयं परस्य च बलं हृदा ॥ ६६-६३
अविचार्यैव प्रभुषु वक्ति सोऽर्हति दण्डनम् ।
युद्धस्योपक्रमे सति ॥ ६६-६४
शरीरनाशं कृष्णात्त्वमवाप्स्यसि न संशयः ।
एवं शप्तो ब्रह्मणाऽसौ
विष्णुमेतदयाचत ॥ ६६-६५
62-65. When he spoke these words, the infuriated Brahma spoke to him:
“O evil-minded one, you say that you can accomplish (the removal of)
the great burden unbearable to all the Devas. It is only due to your
delusion. O childish fellow, you are worthy of being cursed. Without
pondering over what is relevant to the time and place, one's own power
and that of the enemy, if anyone says anything in the midst of lords
and masters, he deserves punishment. Hence at the start of the
battle for the purpose of removing the burden, you will undoubtedly
meet with the destruction of your body at the hands of Krsna.'
Suryavarchas requested Lord Vishnu to grant him the intellect to accomplish any task. Lord Vishnu granted that boon.
On being cursed thus by Brahma, he requested Visnu as follows:
यद्येवं भविता नाशस्तदेकं देव प्रार्थये ।
जन्मप्रभृति मे देहि मतिं
सर्वार्थसाधनीम् ॥ ६६-६६
66.“If my death must occur thus, O Lord, I make a single request. Grant me an intellect that accomplishes all tasks, ever since my
ततस्तथेति तं प्राह केशवो देवसंसदि ।
शिरस्ते पूजयिष्यन्ति देव्याः
पूज्यो भविष्यति ॥ ६६-६७
67.“So be it', said Kesava in the assembly of the Devas, “People will worship your head. You will be worthy of being adored by
Goddess sprayed amruta on Barbarika's head and Barbarika's head witnessed entire Kurukshetra War.
(Sanskrit verses are taken from Dvaipayana.net and English translation from Skanda Purana by Motilal Banarsidass Publishers).