Paramedics resuscitated Pawel Adamowicz, 53, at the scene before taking him to hospital.
A doctor working for the regional authorities, Jerzy Karpinski, described the mayor's condition as "very serious".
A video recording of the attack posted on YouTube showed the attacker bursting onto the podium.
After knifing the mayor, he seized the microphone and claimed to have been wrongly jailed by the previous centrist government of the Civic Platform (PO) and tortured.
"That's why Adamowicz dies," the attacker said.
The attack took place on the podium at a fundraiser for the purchase of medical equipment.
The attacker was quickly apprehended by security guards and arrested by police.
A Gdansk police spokesman said the detained man was a 27-year-old who lived in the city EU President Donald Tusk, Poland's President Andrzej Duda and Prime Minister Mateusz Morawiecki immediately expressed their concern and support for Adamowicz.
"Despite differences in political opinion, I am unconditionally with him and his relatives.... I pray for his health and recovery," Duda added on Twitter.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)