The attacker was injured in the leg and was receiving medical care but his condition is not life-threatening, a police spokesperson said.
"He apparently tried to set fire to this Molotov cocktail and then approached several people including police officers, and the police officers then had to make use of their firearms," said Hamburg police spokesperson Sandra Levgruen.
The man is a 39-year-old German, and may have been acting in a state of mental agitation as he emerged from a snack bar brandishing the weapons, police said in a press release. The police investigation is ongoing.
There was no evidence that the man had any connection to the football tournament, Levgruen said, while the motive for his attack was not clear.
"We assume that this is an isolated case, that is, disconnected from football... I don't see any threat at all or any impact on the game today," Levgruen said.
The incident occurred in the St Pauli district of the city ahead of Poland and the Netherlands' afternoon match at Hamburg's Volksparkstadion, which began on schedule.
Fan marches have been planned ahead of Euro 2024 games, and the parade for Dutch supporters was drawing to a close around the time of the incident. Fans were directed away from the area by police towards the stadium.
Germany is hosting the month-long tournament that began on Friday night.