Praise be to Allah.
Firstly: the origin of this is a Pharaonic custom which was practised by the Pharaohs before Islam, then it spread from them to other nations. It is a reprehensible innovation (bid’ah) which has no basis in Islam, and it is be rejected as the Prophet (peace and blessings of Allaah be upon him) said: “Whoever innovates anything in this matter of ours (Islam) which is not a part of it, will have it rejected.” (Saheeh – agreed upon).
Secondly: commemorating and eulogizing the dead in the manner that is done nowadays, when people gather for that purpose and exaggerate in praising the deceased is not permitted. It was narrated by Ahmad and Ibn Maajah, and classed as saheeh by al-Haakim, that ‘Abd-Allaah ibn Abi Awfaa said: “The Messenger of Allaah (peace and blessings of Allaah be upon him) forbade eulogizing.” (And it is not permitted) because mentioning the attributes of the deceased usually involves boasting and provokes sorrow and grief. But simply speaking well of him when he is mentioned or when his funeral passes by, or mentioning his good deeds and so on, in a manner similar to the way in which the Sahaabah eulogized those who were killed at Uhud and others, is permissible. It was narrated that Anas ibn Maalik (may Allaah be pleased with him) said: “A funeral passed by and they spoke well of the deceased. The Prophet (peace and blessings of Allaah be upon him) said, ‘He deserved it.’ Then another funeral passed by and they spoke ill of the deceased. The Prophet (peace and blessings of Allaah be upon him) said, ‘He deserved it.’ ‘Umar (may Allaah be pleased with him) said, ‘What did they deserve?’ He (peace and blessings of Allaah be upon him) said, ‘The first one you spoke well of, and he deserved Paradise, and the second one you spoke ill of, and he deserved Hell. You are the witnesses of Allaah on earth.” (Narrated by al-Bukhaari and Muslim).