That’s the total number of ways in which he can enter and leave the room. The number of ways in which he can enter the room by one door and leave by **another** door, however, is only $3\cdot 2=6$: he has only $2$ choices of doors through which he may exit, since he must not leave by the door through which he entered.