Kind of embarrassing. LOL
The reason is that Catholics believe in the True Presence. Protestants do not.
Additionally, Catholics must fast and be in a state of grace to receive Communion.
At most weddings and funerals (occasions when non-Catholics may be attending the Mass), the priests usually announce that Communion is limited to Catholics in order to avoid the embarassment that you felt. Also, the missalettes in the pews also list the rules for reception of Communion, generally inside the back cover.
I am sorry for your predicament. It should not have happened.
And the Orthodox Church doesn’t allow Catholics or Protestants to receive communion even when they are Catholics who follow the same rite.
A common faith is a prerequisite for Eucharistic communion.