The pilot had just taken off from an aircraft carrier offshore in the Pacific ocean as part of a training exercise, Lieutenant Katheryn Putnam, a spokeswoman for the air station in Miramar, told the Reuters news agency.
He is currently in a stable condition in a local navy hospital, Putnam said.
Witnesses also told local radio the pilot may have been trying to get the plane to crash in a large canyon nearby in a bid to avoid the school grounds.
One San Diego resident told the MSNBC television channel that the crash shook his house several streets away in the neighbourhood and that officials had told residents to move back.
“I knew definitely it was an explosion … It was pretty strong,” he said.
Local television showed plumes of thick white smoke rising from the crash site in the suburb of the University City area, while the charred remains of a building were also clearly visible.