Prince William flew in to the playing field after transporting doctors from a nearby hospital for the East Anglian Air Ambulance.
While there he spoke to pupils in the school canteen.
Head teacher Mr Matthew said the visit was "completely unexpected".
"It was really quite bizarre. We have the air ambulance use the school site quite regularly and whenever they land the staff go out, we clear the field of children and offer the crew refreshments," he said.
"We didn't realise who was on the helicopter at the time. And then Prince William jumped off and came into the school.
"He was great. He queued up with the children, he got himself some lunch and sat down. Then he was surrounded by a group of Year 11 boys who had a chat with him - it was really lovely."
Mr Matthew said the duke, who has been a pilot for the charity since last summer, ate roast chicken, cauliflower cheese and vegetables, but did not have dessert.
The Duke of Cambridge made a surprise stop at a school in Hertfordshire for a chicken dinner as he took a break from a helicopter flying mission.