The People of the Book used to let their hair hang down, while the polytheists used to part their hair. The Messenger of Allah ﷺ preferred to align with the practice of the People of the Book in matters where he had received no specific revelation, so he let his forelock hang down. Later, however, he parted his hair.
حدثنا أبو بكر بن أبي شيبة حدثنا يحيى بن آدم عن إبراهيم بن سعد عن الزهري عن عبيد الله بن عبد الله
كان أهل الكتاب يسدلون أشعارهم وكان المشركون يفرقون وكان رسول الله ﷺ يحب موافقة أهل الكتاب قال فسدل رسول الله ﷺ ناصيته ثم فرق بعد
Bukhari narrated it in the Book of Virtues, chapter on the description of the Prophet ﷺ, hadith no. 3558, from the hadith of Zuhri through him, and Muslim narrated it in the Book of Virtues, chapter on the description of his hair, features, and appearance, hadith no. 2336, from the hadith of Ibrahim bin Saad through him.