Article snapshot taken from Wikipedia with creative commons attribution-sharealike license.
Give it a read and then ask your questions in the chat.
We can research this topic together.
Om Namah Shivaya (Devanagari: ॐ नमः शिवाय; IAST: Oṃ Namaḥ Śivāya) is one of the most popular Hindumantras and the most important mantra in Shaivism. Namah Shivaya means "O salutations to the auspicious one!", or "adoration to Lord Shiva". It is called Siva Panchakshara, or Shiva Panchakshara or simply Panchakshara meaning the "five-syllable" mantra (viz., excluding the Om) and is dedicated to Shiva. This Mantra appears as 'Na' 'Ma' 'Śi' 'Vā' and 'Ya' in the Shri Rudram Chamakam which is a part of the Krishna Yajurveda and also in the Rudrashtadhyayi which is a part of the Shukla Yajurveda.
Origin of the mantra
The mantra without the initial Om was originally a verse in the eighth hymn of the Namakam section of the Shri Rudram, (TS 4.5.8.1) itself taken from the Taittirīya Samhita, a recension of the Black Yajurveda. It appears as, Namaḥ śivāya ca śivatarāya ca (Sanskrit: नमः शिवाय च शिवतराय च). The English translation of the mantra is, "Salutation to the auspicious one and to the more auspicious".
This mantra also appears in the Rudrashtadhyayi, a part of the Shukla Yajurveda. In the Rudrashtadhyayi, it appears in the 5th chapter (also known as Namakam) verse 41.
Translations among different traditions
Namah Shivaya means "Adoration to Lord Shiva"; this is preceded by the devotional syllable "Om".
In Siddha Shaivism and Shaiva Siddhanta Shaivism traditions, Namah Shivaya is considered as Pancha Bodha Tatva of Lord Shiva and his universal oneness of five elements:
The Tirumantiram (a scripture in Shaiva Siddhanta) announces that "His feet are the letter Na. His navel is the letter Ma. His shoulders are the letter Śi. His mouth, the letter Vā. His radiant cranial center aloft is Ya. Thus is the five-lettered form of Shiva.": Tirumantiram 941. TM
The Mantra appears as 'Na' 'Ma' 'Śi' 'Vā' and 'Ya' in the Shri Rudram Chamakam which is a part of the Krishna Yajurveda. Thus predates the use of Shiva as a proper name, in the original context being an address to Lord Rudra (later Shiva), where Shiva retains its original meaning as an adjective, meaning "auspicious, benign, friendly", a euphemistic epithet of Rudra.
The mantra appears in the Rudrashtadhyayi which is a part of the Shukla Yajurveda.
It appears in the Shiva Purana in the chapter 1.2.10 (Shabda-Brahma Tanu) and in its Vidyeshvara samhita and in chapter 13 of the Vayaviya samhita of the Shiva Purana as Om Namaḥ Śivāya. It is also referenced many times throughout the Śiva Purana as the "5 syllable Mantra" and "6 syllable mantra" when including Om.
The Tamil Saivaite hymn Tiruvacakam begins with the five letters 'Na' 'Ma' 'Śi' 'Vā' and 'Ya'.