Jabir ibn Abdullah reported: The Prophet, peace and blessings be upon him, would return on the day of Eid by using a different route from which he came.
Source: Sahih Bukhari 943, Grade: Sahih (authentic) according to Al-Bukhari
Ibn Al-Qayyim said, “It is said that the reason he did this was to greet the people with peace who lived on both fairways, or so that the blessings of his passing would reach both areas, or to fulfill the needs of those among them. It is said that he did so to establish the symbols of Islam in the various roads and paths. Another reason given is that he did so to frustrate the hypocrites when they witnessed the might of Islam and its people. It is said that he did so in order for the various areas to testify to his obedience to Allah. Surely, he who walks to the mosque and the place of prayer will earn this virtue: one step raises him a degree and another erases a sin until he returns home. It is also said, and this is the correct opinion, that all the reasons mentioned here are possible as well as other unknown wisdom that always accompanied his actions.”
Source: Zaad Al-Ma’ad 1/432
عَنْ جَابِرِ بْنِ عَبْدِ اللَّهِ رَضِيَ اللَّهُ عَنْهُمَا قَالَ كَانَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ إِذَا كَانَ يَوْمُ عِيدٍ خَالَفَ الطَّرِيقَ
943 صحيح البخاري كتاب العيدين باب من خالف الطريق إذا رجع يوم العيد
قال ابن القيم فَقِيلَ لِيُسَلِّمَ عَلَى أَهْلِ الطَّرِيقَيْنِ وَقِيلَ لِيَنَالَ بَرَكَتَهُ الْفَرِيقَانِ وَقِيلَ لِيَقْضِيَ حَاجَةَ مَنْ لَهُ حَاجَةٌ مِنْهُمَا وَقِيلَ لِيُظْهِرَ شَعَائِرَ الْإِسْلَامِ فِي سَائِرِ الْفِجَاجِ وَالطُّرُقِ وَقِيلَ لِيَغِيظَ الْمُنَافِقِينَ بِرُؤْيَتِهِمْ عِزَّةَ الْإِسْلَامِ وَأَهْلَهُ وَقِيَامَ شَعَائِرِهِ وَقِيلَ لِتَكْثُرَ شَهَادَةُ الْبِقَاعِ فَإِنَّ الذَّاهِبَ إِلَى الْمَسْجِدِ وَالْمُصَلَّى إِحْدَى خُطْوَتَيْهِ تَرْفَعُ دَرَجَةً وَالْأُخْرَى تَحُطُّ خَطِيئَةً حَتَّى يَرْجِعَ إِلَى مَنْزِلِهِ وَقِيلَ وَهُوَ الْأَصَحُّ إِنَّهُ لِذَلِكَ كُلِّهِ وَلِغَيْرِهِ مِنَ الْحِكَمِ الَّتِي لَا يَخْلُو فِعْلُهُ عَنْهَا
1/432 زاد المعاد في هدي خير العباد فصول في هديه صلى الله عليه وسلم في العبادات فصل في هديه صلى الله عليه وسلم في العيدين