The Cache in the Castle side quest becomes available during The Locket’s Secret main quest. Travel to the Charms Classroom Floo Flame in The Astronomy Wing. Once there, head down the northeastern steps to find Arthur Plummly standing across from the entrance to Charms Class. Speak with him to be invited on an adventure following a treasure map.
To start, make your way to the Defense Against the Dark Arts Tower Floo Flame in The Astronomy Wing. You’ll then want to keep taking the stairs down until you end up at the globe next to the rhino skeleton. This is the first landmark.
Head down the stairs past the rhino’s head going through the doorway at the bottom of the stairs to reach the Transfiguration Courtyard. The dragon fountain in the center of the courtyard is the second landmark.
Go northwest (behind the dragon) and enter the doorway past the tree. Follow the hallway until you come to a stairwell. Take it up a couple of floors to find the portrait from the map.
Use the Accio facing the map to cause a secret doorway to appear. Head through it and loot the chest to receive the Authentic Historian’s Uniform. Return to Arthur and speak with him to complete the side quest.