While we call it Ne’ilah, its full name is Ne’ilas She’arim (locking of the gates; Mishnah, Taanis 26a). Rashi (ad. loc., DH “Ne’ilas She’arim”) references the Yerushalmi (Berachos, 4th Perek) that gives two explanations of this name:
- Rav holds that it is said with the locking of the gates in Heaven
- R’ Yochanan holds that it is said with the locking of the gates of the Beis HaMikdash
Since, in either case, Ne’ilah would be said close to the end of the day, with these “lockings of the gates,” it became known as Ne’ilah. (Rashi has more to say, regarding how this name applies to other fasts, but that’s irrelevant to our discussion. Below is a copy of Rashi, with my translation.)
נעילת שערים - מפורש בברכות ירושלמי בפרק תפלת השחר אימתי נעילה יש אומרים נעילת שערי מקדש וי"א נעילת שערי שמים שנועלים אותן לעת ערב בגמר תפלה [...]
”Locking of the gates” - it is explicit in Yerushalmi Berachos, Perek Tefillas HaShachar, “When is Ne’lah? Some say the locking of the Temple gates, and some say the locking of the gates of Heaven; for they would lock them close to evening, with the conclusion of the Tefillah.
And the original Yerushalmi (on Sefaria it’s 31a, in the middle; still my translation):
אימתי הוא נעילה רבנן דקיסרין אמרין איתפלגון רב ור' יוחנן רב אמר בנעילת שערי שמים ור"י אמר בנעילת שערי היכל
When is Ne’ilah? The Caesarean Rabbis said: Rav and R’ Yochanan argue. Rav said: with the locking of the Heavenly gates. R’ Yochanan said: with the locking of the gates of the Heichal.