The reason for this meal was written by the Rambam in chapter 30: in order to honor the Shabbat at its entrance and at its departure, meaning that this is like escorting the king with the honor of a meal, and therefore this meal is called "Melaveh Malkah." Therefore, it is customary to say liturgical poems and songs to escort the Shabbat, in the manner that one escorts the king at his entrance and at his departure (Beit Yosef), and therefore it is proper to say the songs after Havdalah (Taz). And they wrote that the sages said that there is one organ in man and its name is "Niskoy," and some call it "Luz," and it does not benefit from any eating except from the eating of Motzaei Shabbat in order to escort the Shabbat (Levush), and from it man was formed. And when he dies—this bone does not decay, and even if they place it in fire it will not be burned, and in a mill it is not ground and with a hammer it is not shattered, and from it man will live at the time of the resurrection, and its root and essence are from the essence of the heavens (Eliyah Rabbah in the name of Matteh Moshe).
וטעם סעודה זו כתב הרמב"ם בפרק ל': כדי לכבד השבת בכניסתו וביציאתו, כלומר שזהו כמלוה את המלך בכבוד סעודה, ולכן נקראת סעודה זו 'מלוה מלכה'. ולכן נהגו לומר פיוטי וזמירות ללוות השבת, כדרך שמלוין את המלך בכניסתו וביציאתו (ב"י), ולכן נכון לומר הזמירות אחר הבדלה (ט"ז). וכתבו שאמרו חכמים שיש אבר אחד באדם ושמו נסכוי, ויש אומרים לוז, ואינו נהנה משום אכילה אלא מאכילת מוצאי שבת כדי ללוות את השבת (לבוש), וממנו נתהוה האדם. וכאשר ימות - עצם זה אינו נימוח, ואפילו יכניסוהו באש לא ישרף, וברחיים אינו נטחן ובפטיש אינו מתפוצץ, וממנו יחיה האדם לעת התחיה ושרשו ועיקרו מעצם השמים (א"ר בשם מט"מ).