The man barged into Shangzhuang Primary School in the eastern city of Weifang in Shandong province, after smashing his motorcycle into the gates of the school, police said.
He attacked children with a hammer and grabbed two of the kids, who were later rescued by the teachers before the attacker poured kerosene on his body and set himself on fire, a city government spokesman was quoted as saying in a news agency report.
Police identified the man as Wang Yonglai, a local farmer.
According to the agency, a teacher who tried to stopped him was also attacked.
Doctors said that the children had sustained minor injuries and their conditions are now stable.