The word Salaam means peace. As-Salaam is therefore one of the attributes of Allah, meaning "The Source of Peace."
وَاِذَا جَآءَكَ الَّذِيۡنَ يُؤۡمِنُوۡنَ بِاٰيٰتِنَا فَقُلۡ سَلٰمٌ عَلَيۡكُمۡ كَتَبَ رَبُّكُمۡ عَلٰى نَفۡسِهِ الرَّحۡمَةَ ۙ اَنَّهٗ مَنۡ عَمِلَ مِنۡكُمۡ سُوۡٓءًۢا بِجَهَالَةٍ ثُمَّ تَابَ مِنۡۢ بَعۡدِهٖ وَاَصۡلَحَۙ فَاَنَّهٗ غَفُوۡرٌ رَّحِيۡمٌ And when those who believe in Our signs come to you, say to them: 'Peace be upon you. Your Lord has made mercy incumbent upon Himself so that if anyone of you does a bad deed out of ignorance and thereafter repents and makes amends, surely you will find Him All-Forgiving, All Compassionate.' (Surah 6. Al-An'am:54)
It is mentioned in the 37th verse Surah 39. Az-Zumar that when the fortune ones will enter the Jannah (Paradise), the guard at the gate will also greet them with same salutation:
وَسِيۡقَ الَّذِيۡنَ اتَّقَوۡا رَبَّهُمۡ اِلَى الۡجَـنَّةِ زُمَرًاؕ حَتّٰٓى اِذَا جَآءُوۡهَا وَفُتِحَتۡ اَبۡوَابُهَا وَقَالَ لَهُمۡ خَزَنَتُهَا سَلٰمٌ عَلَيۡكُمۡ طِبۡتُمۡ فَادۡخُلُوۡهَا خٰلِدِيۡنَAnd those who eschewed disobeying their Lord shall be driven in companies to Paradise so that when they arrive there its gates will have already been thrown open and its keepers shall say to them: “Peace be upon you; you have done well. So enter. Herein you shall abide.”
Even when in Jannah (Paradise), when two believers would meat, they would greet each other with Salam, , as sated in the 23rd verse of Surah 14. Ibrahim:
وَاُدۡخِلَ الَّذِيۡنَ اٰمَنُوۡا وَعَمِلُوا الصّٰلِحٰتِ جَنّٰتٍ تَجۡرِىۡ مِنۡ تَحۡتِهَا الۡاَنۡهٰرُ خٰلِدِيۡنَ فِيۡهَا بِاِذۡنِ رَبِّهِمۡؕ تَحِيَّتُهُمۡ فِيۡهَا سَلٰمٌ
(14:23) As for those who had believed and did good in the world, they shall be admitted to the Gardens beneath which rivers flow. There, with the leave of Allah, they shall abide forever, and will be greeted with: "Peace".
Generally a person meeting with someone or entering someone's house or office should extend this salutation. It common courtesy that if the receiver is sitting, he should stand up and return the salutation.
Who should greet first in Islam? Abu Huraira reported Allah's Messenger (may peace be upon him) as saying: The rider should first greet the pedestrian, and the pedestrian the one who is seated and a small group should greet a larger group (with as-Salam-u-'Alaikum).
According to Imam Nawawi, greeting with the words of as-Salam-u-'Alaikum is a Sunnah, and responding to it is Wajib (obligatory), but this essentiality is of the nature of Kifaya, meaning thereby that if a few persons out of the whole assembly or group respond to the greeting it will absolve all of the responsibility of response but if no response comes forth from any quarter all are held responsible for it. (Translation of Sahih Muslim, Book : 26 KITAB AS-SALAM "THE BOOK ON SALUTIONS AND GREETINGS") [1]
The Prophet Muhammad ﷺ used to greet people by saying As-salamu alaikum and encouraged his followers to do so as well. The tradition helps bond Muslims together as one family and establish strong community relationships. Prophet Muhammad ﷺ once told his followers that there are five responsibilities each Muslim has toward their brothers and sisters in Islam: greeting each other with salaam, visiting each other when someone is sick, attending funerals, accepting invitations, and asking Allah to have mercy on them when they sneeze. [2]
At the end of each prayer/salat, that is while sitting after the tashahhud, durood, and any du'a, the salat is ended by turning head to the right and saying, As-salamu alaykum wa Rahmatullahi wa Barakaatuhu. The angel who records your good deeds is to this side. Turning your head to the left for the angel sitting on the left shoulder and saying, As-salamu alaykum wa Rahmatullahi wa Barakaatuhu.