[the Prophet (PBUH) said] The key to the prayer is cleanliness and its consecrated state is Takbeer, and its conclusion is Tasleem.
As-Salaam is to announce the end of Salaah by saying “As-Salaamu ‘Alaikum wa rahmatullah,” (Peace be unto you and so may the mercy of Allah and His blessings) turning the face to the right shoulder, and As-Salaamu ‘Alaikum wa rahmatullah,” turning the face to the left shoulder.
After praying, one must… bid shalom; if he fails to do so, it would have been better had he not prayed at all
– Alexandri in the name of Yehoshua b. Levi (Talmud Yoma 53b)
Jews share this custom, at the end of the Amidah one looks to the left and to the right saying “Oseh shalom bimromav, Hu yaaseh shalom aleinu ve’al kol Yisrael” (He who makes peace in the heavens, He will make peace, for us and all Israel).
The two customs seem to deviate on which direction one first turns; left (Jews) or right (Muslims). However, a beraita in the Talmud teaches the Jews that 2,000 years ago there were Jews with differing customs and while some turned left, there were also those that turned right.
In the name of Sh’maya, they said that one should give shalom to the right and then to the left, as it is said “From His right [hand] a fiery law for them;” (Deut 33:2) and it is said “A thousand will fall at your side and a myriad at your right…” (Psalms 91:7), Rava saw Abbayei giving shalom to his own right first. He said, “Do you think it means your right side? I meant your left side, which is the right of the Holy One, Blessed be He.”
For these reasons the custom adopted by all modern Jews is to follow Rava and say “Shalom” to the left first. While Muslims have the same custom as Sh’maya and Abbayei and say “Shalom” to the right.
Expanded on an article by Rabbi Ben Abrahamson