Dumbledore hid the two-way mirror in the hopes of protecting Harry Potter from Voldemort.
The mirror, known as the Mirror of Erised, shows the deepest, most desperate desire of the person looking into it.
Voldemort, in his obsession with immortality, sought the mirror as a way to find the Resurrection Stone, one of the three Deathly Hallows.
Dumbledore knew that if Voldemort found the mirror, he would be tempted to use it to find the Resurrection Stone, potentially leading to his own demise.
By hiding the mirror, Dumbledore hoped to prevent Voldemort from ever discovering its true power.
Dumbledore also hid the mirror to protect Harry Potter. Harry, being Voldemort's equal, also had a deep desire to see his parents again. Dumbledore knew that the mirror would be a dangerous temptation for Harry, as it would offer him a false sense of hope and potentially lead him to a harmful path.
By hiding the mirror, Dumbledore hoped to protect both Harry and himself from the dangers of the Resurrection Stone and its potential consequences.