Guru Nanak lived from 1469-1539 and as per his biography, spent the last 15 years of his life at Nankana Sahib, now in Pakistan. I have studied the writings of many Muslim writers from Punjab and Pakistan and they state that Guru Nanak was a convert to Islam. They also state that from around the time of the 5th Guru to the 10th Guru, the Great Guru Gobind Singh,Sikhs veered away from Islam and came closer to Hinduism. In other words they state that the last 5 Gurus for reasons of political power embraced some tenets of Hinduism. But they are firm in stating that Guru Nanak had believed in Islam and considered Mohammed as the Prophet of God.
All this can be very confusing, but there are two pieces of evidence that need to be studied. First, in the Baburnama, which is an account of the life of the emperor Babur in India it is stated that Babur went to meet a holy Pir to seek his blessings just before the battle of Panipat. The reference is to Baba Nanak. It states the Pir Baba blessed him and history records he won the battle of Panipat. Sikh sources do not deny this meeting and concede that the Guru in fact gave 7 fistfuls of sand to Babur, signifying that his dynasty would rule through 7 emperors.
Now we all know that Babur was a staunch Muslim. It is highly unlikely that he would go and visit a Hindu saint. In all probability he was convinced that Baba Nanak was a Muslim Pir and so went to seek his blessings.
Another piece of evidence is the choga worn by Guru Nanak. A choga is a smock or gown worn by Muslim holy saints or pirs. Guru Nanak also wore a Choga and he wore it throughout his life. On his death he handed over the Choga to his disciple Guru Angad, who became the second Guru. The Choga was handed down from generation to generation and is now in the custody of the Bedi family at Dera Baba Nanak, close to Ferozepur in Punjab. All along a myth was created that the Choga had eulogies to Hindu gods on it.
In 1897 on the request of Hazrat Mirza Ghulam Ahmed, the head of the Ahmediya Muslims, the Choga was opened. Hazarat Ghulam claimed that he had a vision that the Choga contained words of glory to the Prophet Mohammad and the Koran. A wonder of wonder, when the Choga was laid bare it was found that all over it were written words glorifying Mohammed as the supreme apostle of god. Words like Laa Ilaha ill Alaah and Muhammad ar-rasool Allah were written all over the Choga. The choga is still available and can be seen.
All this can be very confusing and Muslim writers also claim that Guru Nanak visited Mecca to complete Haj as a Muslim as non Muslims could not enter Mecca. In addition Hazrat Ghulam claims that the Mool Mantra of Sikhism is a direct lift from the Koran.
What is the truth ? There is no doubt that all the evidence does show that Guru Nanak was closer to the Muslim concept of God as he rejected the pantheon of Hindu Gods and rituals. But there is no record that he ever went through the sunta ( circumcision) ceremony, so essential in Islam. Also there is no mention of Muhammad or Islam in the Guru Granth Sahib. In case the guru was influenced by Islam or Muhammad, he would have mentioned about him in the Guru Granth, which does contain secular writings of Muslim saints like Baba Farid.
The fact is Baba Nanak charted a new course and launched a new religion, in which he took the good points like one god from Islam. He was never against Islamic thought and incorporated the concept of a omnipresent, faceless god from Islamic thought. The Choga which is available was probably given by a Muslim woman who had been healed by him and he wore it as he believed that God is after all ONE. He opposed idol worship and the Varna system. Guru Nanak also visited Mecca, but not as a Muslim but as a holy Pir. He mingled with the masses who took him as one of them.
Not withstanding anything else, Guru Nanak is one of the great saints that have taken birth in India and India is a blessed land. there is no doubt he charted afresh course, but its a pity his teachings are not followed in toto by modern Sikhs.