No members of the royal family were there at the time, and "at this stage it is not believed that security was breached," the Metropolitan Police said in a statement.
The man was arrested at 4:15 p.m. in the public area of the castle along with a woman who was with him, police said. Both were held in custody in London and neither was identified by name, age or hometown.
The arrests came less than two weeks after Buckingham Palace in London appointed a new security chief as a government-commissioned report said terrorists could exploit the lax security that had allowed a tabloid reporter to join the royal staff there last year.
Royal and government officials were embarrassed on the eve of a state visit by President Bush in November when Daily Mirror reporter Ryan Parry revealed he had been hired by the palace even though he gave false references.
Last June, a comedian dressed as Osama bin Laden gatecrashed Prince William's 21st birthday party at Windsor Castle, which is located in Windsor, 20 miles outside London.
Wearing a dress, a beard and sunglasses, comedian Aaron Barschak climbed on stage as the prince addressed the crowd and kissed the prince on both cheeks.