Eggs and other non-vegetarian foods are related to Rajo Guna and Tamo guna. Anger, rage, and lustful desires are symbols and qualities of Rajo guna. So, these qualities can reduce the effect of Sattva Guna and increase the effects of Rajo Guna. Sattvic thoughts and actions are qualities of Sattva Guna. When visiting temples or while worshipping, one should most importantly have the Sattvic thoughts. There are chances of losing self-control due to the influence of Rajo Guna and Tamo guna which results in incomplete worship. In order to improve Sattva guna, one should eat sattvic foods which include milk, fruits, leafy vegetables, vegetables, etc. So egg and meat are forbidden during or before worship.
Not only eggs and meat but also onions, garlic and spices have Rajo guna properties. So, these are forbidden for worship too.