United Punjab (including part now in Pakistan was earlier known as "Madhur Desh" (Sweet Country) because of the Fertile Land and sweet river water.
Before that, almost 1,500 years back, it was known as "Sapt Sindu" (Sapt- seven, sindhu- river) as it had 7 rivers flowing through its land.
The inhabitants of this area of Sapt Sindhu (Punjab & neighbouring fertile plains) were called SINDHU.
Since Afghans & other invaders from Central Asia couldn’t pronounce the sound of "S", they pronounced the word SINDHU as HINDU.
So, the inhabitants of Fertile Plains of Sapt Sindhu Region were being called HINDU from that time, around 1,500 years back.
Since Sanatan Dharma was the only religion in this area at that time, all were collectively called HINDUS. This included people from all sects, the upper castes and the lower castes.
Later on, as Mughals invaded India, Islam started spreading here. With the birth of Guru Nanak, Sikhism came into being.