This phrase is not really a slang, but a literal phrase that translates to 'he/she is good when he/she is sleeping'. It is often used humorously or sarcastically to refer to someone who is less trouble or annoying when they're asleep.
Examples
- Spanish: Ese niño es muy travieso. Realmente es bueno cuando está durmiendo.
- English: That child is very naughty. He really is good when he is sleeping.