What Giya said plus security reasons. I bet there'd be a hell lot of scheming ministers and assassination attempts going on if he had lived openly with his identity.
Being the emperor is not a pleasant responsibility.
He doesn't want to compete for the crown, given that he is the emperor's brother, he chose to make a position within the inner palace pretending to be an eunuch to manage the harem.
it's probably already established that jinshi is the emperor's younger bro(?) or son(?) but for novel readers, why is he pretending to be a eunuch?