It was only after about two hours of profuse complaints that the leg was removed.
It is unclear from video footage of the incident if he was aware of what he was lying on while his severed leg was propped up.
Ghanshyam was working as a helper on a school bus when it overturned while trying to avoid colliding with a tractor in the village of Bamouri, 34 miles from the hospital.
Twenty-five schoolchildren were also injured in the accident.
His relatives have alleged that doctors were the ones to place the foot under his head as a pillow.
Relative Janaki Prasad said: 'When we reached the hospital, we saw his leg being used as a headrest.
'I repeatedly asked the doctors to intervene but they refused. Finally, after about two hours, I managed to get a pillow for him from the market and that's when the leg was removed.'
The Uttar Pradesh government is investigating the hospital and action will be taken against those found responsible.
Medical Education Minister Ashutosh Tandon has ordered the suspension of emergency medical officer Dr Mahendra Pal Singh, senior resident Dr Alok Agarwal and nurses Deepa Narang and Shashi Srivastava.