The child – now aged 12 and who cannot be named for legal reasons – said he was going home from Springburn Leisure Centre, Glasgow when he was attacked.
The schoolboy, from Somalia, said he was chased, stopped running and turned round and that is all he can remember before being knocked unconscious but said that his friends told him he was headbutted.
His family have since moved to London.
He was giving evidence at Glasgow Sheriff Court at the trial of John Cassidy, 26, who is accused of assaulting the boy to his severe injury, permanent disfigurement and the danger of his life at Fountainwell Road, Sighthill on October 16, 2011.
Cassidy, from Cardonald, Glasgow denies the charge.
Giving evidence behind a screen, the boy told the jury he was diagnosed with leukemia in 2009 and was still receiving chemotherapy and medication in 2011.
He told procurator fiscal depute Natalie Henderson he was walking with friends after being at the pool when he began to feel sick.
The court heard that he spat chewing gum out on to the road. Then his pals shouted at him to run.
Miss Henderson asked: "Why did your friends say to run?" He replied: "They saw behind me someone running."
The jury heard the boy started running and said he heard "swearing and racist things" being shouted at him.
He said he stopped and turned towards the man who was running at him and that is all he remembers.
He said: "That's all I saw, him run at me" and added "my friends told me he headbutted me".
Miss Henderson asked why his family moved to London and he said: "Because of the accident. I was having nightmares and scared to go outside."
The boy's 14-year-old friend gave evidence that when they were walking home and the boy spat out his chewing gum it hit a passing car.
He told the court: "The car stopped and the person came out and started chasing us, then the five of us got split up, then the person caught up with (the boy) and attacked him by headbutting him."
The trial continues.