Dozens of reasons. In a variety of different orders of priorities.
You're locked in. If someone tries to beat or stab or rape you, you have no way to escape from that threat, nowhere to run.
Homeless people know how homeless people can be. They've seen the crazy, and probably felt a little of it themselves from time to time. They understand the desperation that blurs the line between right and wrong when survival is at stake. They know how predatory a human being can become under the right set of circumstances. And you think it's a good idea to go be locked up with up to 149 other homeless people, most or all of whom are strangers to you, and let your guard down enough to actually sleep, knowing full well that if you do so you will find when you awaken that your survival gear has been taken. Bedbugs and lice are also a certainty if you go to a homeless shelter. Some people don't care, but it does matter a great deal to some people.
Then there's the staff, who dehumanize you, treat you like children if they are kind, treat you like criminals and addicts if they are cruel, or simply try to ignore you as if you aren't really there, don't actually matter.
Because you're locked in from 5 p.m. to 5 a.m., you can't take a cigarette break. You also can't bring alcohol into the shelter. Or drugs. Those things also matter to some people but not to others.
Does that really sound preferable to the open sky, the freedom to come and go as one pleases, to avoid parasites and diseases, to be able to run if the need or even just the simple desire to run arises, to smell no stink but your own, to not have to lie there awake in the dark listening to the farts and snores and masturbatory activities of dozens of strangers, getting peed on when the guy in the bunk above you wets the bed? I mean, seriously, why on earth does anyone think that's a good place to be or a good way to live?
Another factor is that homeless shelters do not accept pets, animal companions, or even service dogs. Many homeless people have animals. Many housed people don't understand why. I've written of this extensively in other answers. But maybe it bears repeating here. This is an excerpt from another answer I wrote:
You discover that society judges your humanity based solely upon the amount of money you have, the stuff you possess, the resources available to you. At first it is shocking to discover that no one looks at you, that their eyes slide by and they ignore you if you speak or smile, like you're not even there, like you don't even exist. You are SHUNNED, and within the first two weeks the emotional and psychological impact of the shunning is devastating. It only grows more profound the longer it continues.Those who don't shun are more inclined to abuse than to be kind.
The lack of human contact drives us crazy. Many will eventually rescue a stray cat or dog. Why, when we can barely feed ourselves and have no shelter, would we obligate ourselves to take on the responsibility of an animal companion? This is one aspect of homelessness that has always perplexed the housed. So let me tell you why. That animal looks at us and sees us. No one else does, aside from the other homeless outcasts, many of whom have become predatory over the years, or the hateful abusers who seek to do violence against us. Furthermore, that animal loves us! Even though we can provide no stable home, even though we may have to root through garbage cans to find something to feed our animal, they bond with us. They know that we will feed them even if doing so means that we ourselves must be hungrier longer. They cuddle up against us and share their body heat. And they want us to touch them. Reach out to shake someone's hand and see them recoil from you. Reach out to pet a dog and see the touch not only welcomed but rejoiced in. Ecstatic pleasure just because you reached out and touched, when the undeniable message you receive from everyone else is that you are lowly, lazy, unworthy, untouchable. You have no idea what that feels like.
That's the end of the excerpt, and hopefully makes it more understandable why homeless folks refuse to be separated from their animals. If the price of getting into a shelter is that you must intentionally make yourself completely alone and unloved before they will let you in the door, it's too high a price to pay.