Crooks's prohibiting of Lennie in his room is less because he really does not want anyone to come in as it is retaliation against the white people who have prohibited him from entering the bunkhouse. This reaction of Crooks to Lennie is the childish "If I can't do ---, then you can't -----"
In addition to this initial emotional reaction, Crooks may have the psychological prevention of allowing anyone in because, once he leaves, I'll be even more lonely.
Crooks has a definite grudge against those who have treated him as a second-class citizen, and we can understand that. He has been relegated to a room in the barn--with the animals. It was a different time, of course, and we shouldn't be too surprised by his bitterness. He has nothing but this room, and he's loathe to share it. What I'm always struck with about Crooks is how everything in his life--including his body-- reflects his bitterness. My guess is that he really wouldn't be happy even if he were suddenly allowed to bunk in with the rest of the men. The bitterness and anger just run too deep. The only reason Crooks lets Lennie in is because he recognizes someone with even more disadvantages in his life than he has had, and he has a chance--perhaps for the first time in his life--to feel superior to someone else.
Crooks doesn't want Lennie in his room because it is the one space he has that is his--he's "lord" of his humble abode in the barn. Additionally, Crooks is forbidden from most of the places or activities associated with the white men on the ranch; so this is his opportunity to control the situation for once. However, when Crooks realizes that Lennie is someone he can talk to--a pleasure unknown to Crooks--he allows Lennie to enter. He is so lonely that he is willing to let down some of his barriers (at least for a while) in order to talk to someone.