The incident occured early on Sunday morning.
Police sources told rediff.com that the student, along with another boy, was racing his motorcycle on MG Road on Sunday morning, about 1 am.
The police tried to stop the boys, without success.
After a chase, the student, apparently in a bid to evade the police, entered the army campus in the MG Road-Ulsoor area.
Army personnel, who spotted the boy, asked him to identify himself and surrender. When he refused to do so, they opened fire. The boy, later identified as Mohammed Mukram, was rushed to hospital, but he succumbed to his injuries.
PTI adds: The student had allegedly engaged in 'wheeling' (riding a motorcycle on its rear wheel) at high speed in the wee hours and was confronted by the police.
As he left his bike and started fleeing, the police gave him chase, police sources said, adding that he then jumped into the compound of FlagStaff House, where a brigadier was staying, on the Airport Road in a bid to hide at around 1 am.
A defence ministry statement said after a thorough search, the sentries on guard sensed the presence of somebody on top of the brigadier's house.
'Before the guards could apprehend the intruder, he jumped down and fled towards the compound wall facing the main road,' the statement said.
'When the intruder did not heed the armed guards' warning to surrender, the intruder was fired upon. The police are investigating the case,' it added.
More from rediff