On assuming command, 10th guru govind started plundering neighborhood areas to raise money.
Mughal fojdars hunted him down and he was forced to to stay hidden.
Then, he enlisted the help of Afghans (Moslem Fakirs) to get him to safety in exchange for money.
They asked him to grow his hairs and beard, and gave him short blue tunic to wear, just like themselves. And carried him throughout the region in safety.
Feeling lucky to be in safety, thus he adopted this attire (Long hairs and blue robes) for his men.