Elwy Ali Okaz, who was stabbed as he tried to protect el-Sherbini, his wife, was then shot in the leg by police who apparently took him for the attacker.
Testifying on Monday, Okaz said: "The perpetrator suddenly attacked my wife, he hit her several times and when I tried to help he hit me too.
"It was only then that I noticed he had a knife and that he had stabbed her. Then he began stabbing me too."
Okaz said the alleged attacker continued stabbing his wife even after she was on the ground.
Egyptian media quickly dubbed el-Sherbini a martyr and there were huge protests against the murder in countries including Egypt, Iran and Turkey.
Amr El-Kahky, Al Jazeera's correspondent in Cairo, said: "Since the killing of Marwa el-Sherbini in Dresden, every Egpytian has been angry and they are all asking for justice.
"The picture of Marwa el-Sherbini has been published in most of the papers ... everyone is waiting to see what this man will plead in the case."
El-Sherbini and the defendant met in August 2008, when she asked him to clear a playground swing where he sat smoking a cigarette so Mustafa could use it.
He refused, calling el-Sherbini an "Islamist", a "terrorist" and a "whore". She pressed charges for defamation and he was fined $1,170.
An appeal against the conviction brought them together again in July.
The defendant allegedly plunged an 18cm kitchen knife into the chest, back and arm of el-Sherbini, 31, three months pregnant at the time with her second child.
|El-Sherbini was three months pregnant
at the time of her murder [EPA]
"He stabbed them out of pure hatred against non-Europeans and Muslims. He wanted to annihilate them," Frank Heinrich, a prosecution lawyer, told the court on Monday, where many people were wearing badges with el-Sherbini's face.
About 200 police officers were on hand as the defendant entered the court in a hooded top and sunglasses, which Birgit Wiegand, the judge, asked him to remove.
He lowered the hood but kept the glasses on, prompting Wiegand to give him a $75 fine.
She threatened him with another fine when he refused to confirm his name or place of birth.
Court psychiatric experts who examined the defendant, who is also charged with attempting to kill Okaz, say they found no evidence of diminished responsibility.
The attack, and a slow reaction by the German media and political class, sparked accusations of neglectful handling of hate crimes against Muslims.
Thousands also rallied in Dresden in el-Sherbini's memory.
The Egyptian government on Sunday demanded the maximum sentence under German law, life in prison, for the attack.
Asked what ordinary Egyptians hoped would emerge from the trial, Ramzy Ezzeldin Ramzy, Egypt's ambassador to Germany, said: "This was a heinous crime and they are expecting justice to be administered in a swift way."
El-Sherbini's family appeared in Dresden as co-plaintiffs, represented by lawyers hired by the Egyptian government, the Egyptian foreign ministry said, adding that it was "confident in the German justice system's impartiality".
Representatives from the prosecutor's office in her hometown of Alexandria were also in the courtroom, as were Egyptian reporters.
El-Sherbini worked as a pharmacist while her husband is a geneticist working on his doctorate in Dresden.
The unemployed defendant, who arrived in Germany from Perm in the Urals in 2003, reportedly struggled with bouts of depression.
"In this trial we will try to get to the bottom of the circumstances surrounding the death of a young woman who was deeply integrated in her family and society," Wiegand said.
A verdict is expected on November 11.