It’s not easy to track back the Origin of the Panchakshari Mantra, Namah Shivaya. The first epigraphical writing as evidence is said to be found in the 8th Anuvaka , of Sri Rudram where the first part of paragraph starts with “Namah shivaya”.
namah śivāya ca śivatarāya ca
Salutation to the auspicious one and to the more auspicious (or the paramātman or the absolute)
It has been stated:
“िवद्यासु श्रुितरुत्कृष्टा रुद्रैकादिशनी श्रुतौ । ति पञ्चाक्षरी तस्यां िशव आत्यक्षरद्वयम् ॥“ “Of Vidyas, Veda is the greatest; in Veda, ‘Sri Rudram ’ containing 11 Anuvakams is the greatest; in that the Panchakshara ‘Nama: Sivaya ’ is the greatest; there too, the two letters ‘Siva’ are the greatest.”
In Agamas, the term ‘Siva’ is called ‘Jivaratnam’. Siva Puranas have explained in detail the merits of this Name.
If you read Viniyog (Mantra Declaration) as in Mantra Shastra, then Vamdeva himself is the Rishi (Seer) of this mantra.
Vamadeva (वामदेव) is the preserving aspect of the God Shiva, one of six aspects of the universe he embodies, as well as the name of an ancient rishi. On a five-faced Shivalingam, Vamadeva appears on the right hand side. This face/aspect of Śiva is considered the peaceful, graceful and poetic one — the lord of the female aspect of it is associated with water.
The Brahman splits into male (Parashiva) and female (Parasakti) and manifests as the universe. The Parashiva has five faces. Indeed The five letters "Na" , "Ma" , "Shi", "Va" , "Ya" denote the five heads of ParaShiva..
It is said that Lord Siva Himself was the guru of the Saivite saint Manickavachagar He inspired in his mind the ‘Na-mah Shi-va-ya' mantra, and he forwarded this to rest of mankind.
Siva is the Lord of Mantras and indeed all Tantras as well are coming from His Grace. Lord Pashupati is the seer and the rishi, the beginning and the end of every universe.