Khalsa Panth is path of Akal Purakh (Non-Temporal Lord or Almighty) for the sole purpose to spread teachings of true Dharma(Gurmat) among people. It was revealed by Guru Gobind Singh with assistance of Akal Purakh. 
In 1699, Khalsa Panth was revealed which:
- Lead by 5 most learned and enlightened Sikhs, called Panj Pyare;
- who will preach and spread true Dharma (Gurmat);
- can be identified by similar dress code(Five ks).
- manage affairs of army and Sikhs;
- and always ready to die for Gurmat;
- and named as Khalsa.
Literally, it is theocracy that manages the affairs of the Khalsa Army and Sikhs. The Baptism procedure includes Mixing water and patasha(Suger Cubes) in Iron Utensil; called Sarabloh Bata; churning using Kirpan or Khanda and reciting 5 Banis. The mixture is originally called Khande Batey Ki Pahul, generally known as Amrit, among Sikhs.
Discussion of Guru Gobind Singh and Akal Purakh
In his autobiography, Guru Gobind Singh penned down his discussion with Akal Purakh, on revelation of Khalsa Panth. The actual date and time of discussion is immeasurable. The discussion happened at the time, when Guru Gobind Singh was in supreme state. His following text explains the details of reason of reveal:
ਅਬ ਮੈ ਅਪਨੀ ਕਥਾ ਬਖਾਨੋ ॥ ਤਪ ਸਾਧਤ ਜਿਹ ਬਿਧਿ ਮੁਹਿ ਆਨੋ ॥
अब मै अपनी कथा बखानो ॥ तप साधत जिह बिधि मुहि आनो ॥
Now I relate my own story as to how I was brought here, while I was absorbed in deep meditation.
ਹੇਮ ਕੁੰਟ ਪਰਬਤ ਹੈ ਜਹਾਂ ॥ ਸਪਤ ਸ੍ਰਿੰਗ ਸੋਭਿਤ ਹੈ ਤਹਾਂ ॥੧॥
हेम कुंट परबत है जहां ॥ सपत स्रिंग सोभित है तहां ॥१॥
The site was the mountain named Hemkunt, with seven peaks and looks there very impressive.1.
ਸਪਤ ਸ੍ਰਿੰਗ ਤਿਹ ਨਾਮੁ ਕਹਾਵਾ ॥ ਪੰਡੁ ਰਾਜ ਜਹ ਜੋਗੁ ਕਮਾਵਾ ॥
सपत स्रिंग तिह नामु कहावा ॥ पंडु राज जह जोगु कमावा ॥
That mountain is called Sapt Shring (seven-peaked mountain), where the Pandavas Practised Yoga.
ਤਹ ਹਮ ਅਧਿਕ ਤਪਸਿਆ ਸਾਧੀ ॥ ਮਹਾਕਾਲ ਕਾਲਿਕਾ ਅਰਾਧੀ ॥੨॥
तह हम अधिक तपसिआ साधी ॥ महाकाल कालिका अराधी ॥२॥
There I was absorbed in deep meditation on the Primal Power, the Supreme KAL.2.
ਇਹ ਬਿਧਿ ਕਰਤ ਤਪਿਸਆ ਭਯੋ ॥ ਦ੍ਵੈ ਤੇ ਏਕ ਰੂਪ ਹ੍ਵੈ ਗਯੋ ॥
इह बिधि करत तपिसआ भयो ॥ द्वै ते एक रूप ह्वै गयो ॥
In this way, my meditation reached its zenith and I became One with the Omnipotent Lord.
ਤਾਤ ਮਾਤ ਮੁਰ ਅਲਖ ਅਰਾਧਾ ॥ ਬਹੁ ਬਿਧਿ ਜੋਗ ਸਾਧਨਾ ਸਾਧਾ ॥੩॥
तात मात मुर अलख अराधा ॥ बहु बिधि जोग साधना साधा ॥३॥
My parents also meditated for the union with the Incomprehensible Lord and performed many types of disciplines for union.3.
ਤਿਨ ਜੋ ਕਰੀ ਅਲਖ ਕੀ ਸੇਵਾ ॥ ਤਾ ਤੇ ਭਏ ਪ੍ਰਸੰਨਿ ਗੁਰਦੇਵਾ ॥
तिन जो करी अलख की सेवा ॥ ता ते भए प्रसंनि गुरदेवा ॥
The service that they rendered the Incomprehensible Lord, caused the pleasure of the Supreme Guru (i.e. Lord).
ਤਿਨ ਪ੍ਰਭ ਜਬ ਆਇਸ ਮੁਹਿ ਦੀਆ ॥ ਤਬ ਹਮ ਜਨਮ ਕਲੂ ਮਹਿ ਲੀਆ ॥੪॥
तिन प्रभ जब आइस मुहि दीआ ॥ तब हम जनम कलू महि लीआ ॥४॥
When the Lord ordered me, I was born in this Iron age.4.
ਚਿਤ ਨ ਭਯੋ ਹਮਰੋ ਆਵਨ ਕਹਿ ॥ ਚੁਭੀ ਰਹੀ ਸ੍ਰੁਤਿ ਪ੍ਰਭੁ ਚਰਨਨ ਮਹਿ ॥
चित न भयो हमरो आवन कहि ॥ चुभी रही स्रुति प्रभु चरनन महि ॥
I had no desire to come, because I was totally absorbed in devotion for the Holy feet of the Lord.
ਜਿਉ ਤਿਉ ਪ੍ਰਭ ਹਮ ਕੋ ਸਮਝਾਯੋ ॥ ਇਮ ਕਿਹ ਕੈ ਇਹ ਲੋਕਿ ਪਠਾਯੋ ॥੫॥
जिउ तिउ प्रभ हम को समझायो ॥ इम किह कै इह लोकि पठायो ॥५॥
But the Lord made me understand His Will and sent me in this world with the following words.5.
ਅਕਾਲ ਪੁਰਖ ਬਾਚ ਇਸ ਕੀਟ ਪ੍ਰਤਿ ॥
अकाल पुरख बाच इस कीट प्रति ॥
The Words of the Non-temporal Lord to this insect:
It refers to the entire nation of people who have taken the way of the Khalsa, and hence the Panth is self managed.
Establishing of Khalsa - 1699
Guru Gobind Rai was 33 years old when he had Divine inspiration to actuate his designs. In early 1699, months before Baisakhi Day, Guru Gobind Rai sent special edicts to congregations far and wide telling all the Sangats that that year's Baisakhi was going to be a unique affair. He asked them not to cut any of their hair — to come with unshorn hair under their turbans and chunis, and for the men to come with full beards.
False Beliefs regarding revelation of Khalsa Panth
Following are some beliefs preached by pseudo scholars and scholars of other religion regarding Khalsa Panth which are philosophically wrong.
Protection of Hindu Religion
As sole purpose is to spread teachings of true Dharma(Gurmat) among people. But there is a wrong perception among most of people in India and world that Khalsa Panth was created to protect Hindu Religion which is philosophically not true. Firstly, Hindu is not any organized religion; But there are different Matt or Mattantar in Hindu Religion which includes Yogis, Bairagis, Sanyasis, Vedis, Brahmins, Udasis, Vaishnavs, Naths etc. In autobiography, Guru Gobind Singh is admonishing all of these. Also he is admonishing all Hindu Rituals and Practices. For example; The rejection of Brahma, Vishnu and Mahadeva in one stanza of above composition:
ਮਹਾਦੇਵ ਅਚੁੱਤ ਕਹਾਯੋ ॥ ਬਿਸਨ ਆਪ ਹੀ ਕੋ ਠਹਿਰਾਯੋ ॥
महादेव अचु्त कहायो ॥ बिसन आप ही को ठहिरायो ॥
Mahadeo (Shiva) was called Achyuta (blotless), Vishnu considered himself the Supreme.
ਬ੍ਰਹਮਾ ਆਪ ਪਾਰਬ੍ਰਹਮ ਬਖਾਨਾ ॥ ਪ੍ਰਭ ਕੋ ਪ੍ਰਭੂ ਨ ਕਿਨਹੂੰ ਜਾਨਾ ॥੮॥
ब्रहमा आप पारब्रहम बखाना ॥ प्रभ को प्रभू न किनहूं जाना ॥८॥
Brahma called himself Para Brahman, none could comprehend the Lord.8.
It was revealed for protection of truth (Gurmat).
To fight with Mughals
There is no reference in above discussion on creation due to that reason. Guru Gobind Singh fought battle with Hill rulers who were orthodox Hindus, also known as Pahadi Raje or 22 Dhari Raje. These Hindu Kings planned to throw Guru Gobind Singh out of Anandpur, with help of Centre Mughal Government. Where Bahadur Shah maintained Good relation with Guru Gobind Singh, there Wazir Khan was hostile of Guru Sahib. Khalsa Panth is to stand on and fight for truth whether philosophically or in battle field.
- ^ ਅਕਾਲ ਪੁਰਖ ਬਾਚ ॥(The Word of the Non-Temporal Lord): ਮੈ ਅਪਨਾ ਸੁਤ ਤੋਹਿ ਨਿਵਾਜਾ ॥ ਪੰਥ ਪ੍ਰਚੁਰ ਕਰਬੇ ਕਹੁ ਸਾਜਾ ॥;I have adopted you as my son and hath created you for the propagation of the path (Panth): Retrieved From Bachitar Natak, Dasam Granth
- ^ ਜਾਹਿ ਤਹਾਂ ਤੈ ਧਰਮੁ ਚਲਾਇ ॥ ਕਬੁਧਿ ਕਰਨ ਤੇ ਲੋਕ ਹਟਾਇ ॥੨੯॥: You go therefore for the spread of Dharma (righteousness) and cause people to retrace their steps from evil actions".29.
- ^ ਦੋਹਰਾ ॥ ਠਾਢ ਭਯੋ ਮੈ ਜੋਰਿ ਕਰ ਬਚਨ ਕਹਾ ਸਿਰ ਨਿਆਇ ॥ਪੰਥ ਚਲੈ ਤਬ ਜਗਤ ਮੈ ਜਬ ਤੁਮ ਕਰਹੁ ਸਹਾਇ ॥੩੦॥: I stood up with folded hands and bowing down my head, I said:The path (Panth) shall prevail only in the world, with THY ASSISTANCE."30.: Bachitar Natak, Dasam Granth, Guru Gobind Singh.