Being Narmadiya means people who are originated from Maa Narmada. King Mandhata was a Kshatriya who had no successor to sustain his monarchy. The King worshipped Lord Shiva to save his bloodline by making a temple on an island in river Narmada and did Tapasya for many years.
When Lord Shiva decided to visit him, he asked the Lord to give him the boon of a son and asked the Lord to stay in his Kingdome.
Lord Shiva told him to worship Maa Narmada, as being a holy and ancient river; goddess Narmada was the lifeline of his Kingdome and his people. She provided prosperity and all the happiness to his people. If the king asks Maa to save his bloodline, it would be a humble request.
The king than worshiped Maa Narmada and Maa gave him not one but 12 sons and asked the king to bring them up as Brahmins and not as Kshatriya.
The king obeyed her instructions and the bloodline of the king was saved. All the 12 kids were brought up as Brahmins and they called Narmadiya Brahmins. The names of all the 12 brothers are what we refer as our Gotras today.
Lord Shiva stayed in the Kingdome of King Mandhata as Omkareshwar Jyotirling as per the kingâ€™s request.