They're called Crew Rest Compartments and their location on the plane varies. On newer aircraft, such as the Boeing 787 or the Airbus A350, they are located above the main cabin, in the upper fuselage. But on older aircraft, they can also be in the cargo hold or simply in the main cabin.