Why is it customary to eat eggs or egg salad on shabbat?
As far as I know, the real custom is to eat a type of egg salad that also contains onions, with the main point of it being the onions. The reason for the custom is because we want to have all types of delicacies on shabbos, as it says “you should call the shabbos a delight”. We also know that the Manna in the desert tasted like any type of food that one wanted except for a few foods, and onions was one of them. Therefore we eat onions on shabbos in order to include even this type of food.
Taamei Haminhagim 116.