It was a dream of a separate homeland for the Sikh community. The Khalistan movement can be traced back to the 1940s when Nehru promised Sikhs an area/ state, so they can have a sense of freedom, but during the partition, Hindu and Muslims were major issues.
In 1947, Kapur Singh made a controversial state and tried to start the Khalistan movement but was ignored till demand was made to make Punjabi be the official language in the 1950s. Then came 1979, when the Khalistan movement actually started. Khalistan National Council was created by Jagjit Singh Chauhan after he lost Punjab Assembly Election.
He even issued Khalistan passports, stamps, currency and declared himself as president of the “Republic of Khalistan“. Khalistan means “land of Khalsa (pure)” or Sikh homeland in politics. During this, he was residing in the UK and visiting Pakistan regularly.
At that time Akali Dal and Congress were strong opponents. In 1983, 6 Hindu passengers were taken off a bus and killed. Akali Dal started protesting against the Indian Constitution in which Sikh/Jains/Buddhists were referenced as Hindu. Akali Dal demanded Sikh-specific laws.
And during this Bhindranwale(religious leader) decided to bring ammunition into Golden Temple and shelters were provided to Sikh Militants. Pakistan tried their best to make it an international issue, they were helping Militants (money, weapons, and training). Then came Operation Blue Star.
Indira Gandhi ordered the army to free Golden Temple from Militants. The army surrounded the temple but Militants started firing while pilgrims were still inside the temple, which resulted in the death of Bhindranwale and more than 500 civilians.
Khalistan movement was never a demand made by civilians. It was a whole political mess created by politicians to fulfill their hunger for power and even today used by some of them. The Sikh community has always been dedicated towards its nation, just because a few apples are rotten, you can’t blame the whole barrel.