Eton School pupil Horatio Chapple was sleeping in his tent in the Svalbard islands in August 2011 when the bear inflicted wounds to his head and upper body.
Andrew Ruck, 27, from Edinburgh, described how the polar bear initially attacked team leader Michael Reid, known as Spike, in their tent after he tried to shoot it.
He was giving evidence about the British Schools Exploring Society (BSES) expedition to an inquest in Salisbury, Wiltshire.
He said the bear had its paws on his shoulders and he was looking straight into its face.
Mr Ruck said: "I woke up straight away and sat bolt upright, I then remember Spike or I opening the tent to see the polar bear there, I do not think it had anyone or anything in its mouth at that stage."
He said he then saw Mr Reid attempting to fire the rifle at the bear.
He said: "He tried to fire the rifle four times, bullets emptied out, he shouted 'It's not working' and then the bear came over to him and knocked him to the floor.
"After that I exited the tent through the other entrance. I just charged towards the bear, shouted and picked up rocks and threw them at its face."
He said the bear knocked him to the floor and he could recall its paws being on his shoulder and seeing its face.
He added: "It swiped my face with its claw and my head would have ended up in its mouth at some point. The bear left me for some reason but I had very few clear thoughts after that.
"I know I ended up not in the spot where it attacked me and ended up right next to Horatio. I must have been aware someone had been very badly injured and I think I was trying to help."
Mr Ruck said a decision had been made to use a tripwire system as an early warning alert that night, and added that a bear watch would have had its own risks if it had been used instead.
He admitted bear watches were not "fool-proof" and open to human error. He said he once fell asleep during a watch and people were often tired standing around watching for bears in the cold, which numbs their reaction times.
Mr Ruck was a late addition to the team, but had visited the area with the society and its young explorers in 2002.
He added: "Most encounters with polar bears are not fatal or even problematic. I am certainly aware that the behaviour of our bear charging into the campsite is completely abnormal."
Earlier, Mr Reid who was seriously injured in the incident, said he was awoken by several people shouting "bear attack". He then grabbed the group's rifle and left his tent.
He said: "There were shouts of 'bear', or 'bear attack', male voices, from more than one person. Immediately I exited the tent through one of the doors with the rifle. The only priority was getting out as swiftly as possible and taking the rifle with me."
He continued: "The bear was close and it was on top of one of the YEs [young explorers] in their sleeping bags. I believe it was Scott Bennell-Smith. I was not focussing on other people other than the bear that was on top of person on the ground. I do not recall seeing Horatio."
Mr Reid said he shot at the animal's chest, but the rifle did not fire. He took another failed shot before emptying the magazine of bullets.
Also injured before the bear was shot dead were 17-year-old Patrick Flinders, 17, of Jersey, and 16-year-old Mr Bennell-Smith, of Cornwall. The inquest continues.