Organisers had cancelled the march following the violence, police said, but many demonstrators remained on the streets.
At least one person appeared to have been seriously hurt and was carried away covered by a foil blanket.
World leaders including US President Donald Trump are in Hamburg for talks on a wide range of issues.
The clashes began when police charged a group of anti-capitalist demonstrators at the march attended by thousands carrying banners with slogans such as “Welcome to hell” and “Smash G20”.
They fired water cannon and pepper spray at masked protesters, who hurled bottles, stones and flares at police.
Medics were seen treating several people. Other protesters built makeshift barricades on streets. At least one vehicle had been set alight and businesses had been damaged, police said.
Up to 100,000 protesters are expected in Hamburg during the summit. Earlier, police had warned of possible violence and said they had confiscated a number of homemade weapons.
The G20 leaders face their own disagreements, including over climate change and trade.
Mr Trump has already met German Chancellor Angela Merkel and the pair spent an hour talking about North Korea, the Middle East, the conflict in eastern Ukraine and G20 issues, a German government spokesman said.
Last week Mrs Merkel said the G20 would focus on the Paris climate deal – which the US has withdrawn from. But earlier she said that as the G20 host she would work to find compromises.
The summit will also see Mr Trump meet Russian President Vladimir Putin for the first time.
Read more on BBC