The Mishnah (Gittin 59a) says:
כהן קורא ראשון ואחריו לוי ואחריו ישראל מפני דרכי שלום
A Kohen reads first, then a Levi, then a Yisrael, because of the ways of peace.
The Gemara (ibid. 59b) explains:
לא שנו אלא בסעודה אבל בבהכ"נ לא דאתו לאינצויי
They only taught [that one waits to accord respect] by a meal, but in a shul, we do not, for people will come to quarrel.
When coming to honor the deceased, everyone is obligated to pay their respects, and so there's no concern for quarrel; therefore, the deceased gets the first Aliyah. This is indicated by the Gemara's following question and answer:
והא רב הונא קרי בכהני בשבתות ויו"ט שאני רב הונא דאפילו רבי אמי ורבי אסי כהני חשיבי דא"י מיכף הוו כייפי ליה
Rav Huna read the Kohen aliyah on Shabbos and Yom Tov! Rav Huna is different, for even R' Ami and R' Asi, the most distinguished Kohanim in Eretz Yisrael, would bow to him.
Since everyone would pay respect to Rav Huna, he could take the Kohen aliyah, even without being a Kohen himself. So, too, since everyone pays respect to the deceased, he gets the Kohen aliyah.