Joe Russo, who co-directed the upcoming blockbuster with his brother Anthony, plays the role early on in the film, Deadline reported on Thursday.
The man played by Joe is not a superhero but rather a civilian, who appears at the beginning of the movie as a member of a support group for those whose loved ones have died when Thanos wiped out half of the galaxy in Avengers: Infinity War.
He can be heard talking about his late male partner, and going on his first date since the man's death.
This isn't a major role, and the character only appears for a brief moment, but it marks the first time a gay character has been openly featured in the Marvel Cinematic Universe.
“Representation is really important,” Joe Russo told Deadline.
“It was important to us as we did four of these [Avengers] films, we wanted a gay character somewhere in them. We felt it was important that one of us play him, to ensure the integrity and show it is so important to the filmmakers that one of us is representing that.
"It is a perfect time, because one of the things that is compelling about the Marvel Universe moving forward is its focus on diversity.”
The reveal comes amid growing speculation that Marvel might add an openly gay superhero to its line-up in the near future.
Avengers: Endgame opens on 25 April in the UK and 26 April in the US.