Zhou Xingbai had been working at an electronics company in Kunshan city near Shanghai but had lost his savings through gambling and was having difficulty supporting himself, the Shanghai police department said in a statement on its official microblog.
Zhou told his friends through social media that he "owed many people money" and was "preparing to do something extremely crazy" and "losing his little life was a certainty", the statement said.
A previous government statement said Zhou threw a beer bottle packed with explosives near a check-in counter in Terminal Two at Pudong International Airport on Sunday afternoon.
He then took out a knife and slashed at his own neck before being admitted to hospital in critical condition.
Police said he used gunpowder from fireworks in his home-made explosive device, residue of which was found in his rented room in Kunshan.
"A beer bottle with a burning fuse rolled into the queue when we were waiting for check-in," passenger Susan Shen was quoted as saying by the Shanghai Daily newspaper.
"And then suddenly the bottle exploded with a loud bang and colourful flash like fireworks."
Zhou, originally from the southwestern province of Guizhou, had a high-school education and worked at various jobs before arriving in Kunshan in 2014, police said.
There have been several cases in China of disgruntled individuals setting off explosions or starting fires in revenge for perceived wrongs.
In 2013 a wheelchair-bound man detonated a homemade bomb at Beijing international airport as a protest at alleged police brutality.
The man, Ji Zhongxing, was later sentenced to six years in jail.
Last year an unemployed man set off an explosion at a public park in the eastern province of Shandong, killing himself and another person and wounding 24.