Photographers caught the moment two security guards approached the Danish supporters and took hold of the flag, prompting a reaction from nearby fans.
Uefa are investigating the incident, insisting the stewards were not acting on guidance from European football’s governing body.
A statement to Standard Sport reads: "Uefa never instructed stewards in Baku - or in any other stadium - to confiscate rainbow flags.
“We are currently investigating what happened and we will of course contact the Uefa delegate, Uefa Security officer and local authorities to clear this up.
“The initial information we received was that the supporter in question appeared heavily intoxicated and that some local supporters turned aggressive towards him. The local stewards intervened and allowed the supporter to remain, despite his state.
“The rainbow flag is a symbol that embodies UEFA core values, promoting everything that we believe in - a more just and egalitarian society, tolerant of everyone and UEFA has ensured that the flag was returned to the supporter."
Euro 2020 sponsor Volkswagen on Friday said it was told by Uefa that rainbow-coloured banners were banned on advertising boards at the quarter-finals in the Azerbaijan capital and fellow tournament venue Saint Petersburg in Russia.
Uefa confirmed the directive, adding it "requires its sponsors to ensure that their artwork is compliant with local legislation."
Last week, Uefa rejected a request from the mayor of Munich, Dieter Reiter, to illuminate the city's stadium in rainbow colours for Germany's match against Hungary.
Uefa said the request was political, and made in response to legislation in Hungary banning the display and promotion of homosexuality to under-18s. Reiter described that decision as "shameful".
Additional reporting by AP.