One of the issues with rescues, shelters, street dogs, and any dog not raised by knowledgeable, responsible breeders is that the first 12 weeks of a puppy's life are CRUCIAL for setting the personality of that puppy. After that, the window closes and you can't get that time back. Good breeding can only go so far; if the dog is deprived of socialization, certain experiences, or mistreated, scared, or hurt during those crucial weeks, there is often nothing you can do later in life to fix it -- you can sometimes improve it, but the dog's default behavior will be fear or anxiety or aggression rather than interest or acceptance. Dogs of questionable breeding and temperament who get those crucial experiences sometimes still turn out ok in the right home. Dogs of questionable breeding and temperament who also experienced pain, fear, mistreatment, or simply didn't get the handling and experiences needed during those all-important few weeks are behind the 8 ball for life and tend to be the ones that just aren't functional. It's not your fault. It's the fault of whoever bred him, mishandled him, etc.
I took in a lab/border collie puppy after we saw two of them tossed from a moving truck in a parking lot. An acquaintance took the other. They were around 6-7 weeks old when we got them. the puppy was overly shy, thin, and obviously frightened of people. He was so terrified at the vet clinic when I had him checked over and got him his shots that he was nearly catatonic. I had another calm, stable dog in my home and the puppy took to her right away and her bombproof personality went a long way toward instilling confidence in him. I also took him everywhere I could to get him around people, other dogs, and to get good experiences flooding his little brain rather than his default behavior that being approached by people meant he should run away or he'd be hurt. We spent a lot of time sitting under a tree in the park and I'd start handing him chicken or cubes of cheese every time another person came into view until he started thinking that other people and dogs might actually be ok. Then we went to the farm stores, banks, anywhere that wasn't overwhelming where he could learn that new experiences were ok. He turned out to be a nice little dog, but anxious around new situations his whole life. I had hoped to use him as a competitive frisbee dog because he was OBSESSED with frisbees, but there's no way he could have tolerated a performance event atmosphere. He also had meltdowns when confronted with livestock/sheep so that career was also off the table. I ended up giving him to my parents as their calm, quiet home was a much better fit for him than mine with other foster dogs coming in and out, two other dogs with show/performance careers, etc. I met the other puppy a year later, and whoa, what a difference. His owner had a health crisis come up soon after she took him in, and he ended up living in a stall in her horse barn until he was about 5 months old. He got much the same experiences as my pup after that, but it was too late. That dog was a nutcase. He was terrified of everything, would destroy the house when left alone, would panic in a crate until he hurt himself or got out of it, his reaction to other dogs and new people was to turn and run, and if he couldn't do that, to attack first before they got to him. She ended up euthanizing him a couple of years later when he refused to tolerate her infant son no matter what she tried.
The difference between dogs like this, and dogs from solid, stable parents bred by responsible breeders who take the time to do the work on the babies and teach them to learn and love people and accept new things with aplomb is astronomical, and even then you can sometimes get one that 'isn't quite right'. Rolling the dice on a dog that didn't get that crucial early experience and well-thought-out breeding sometimes results in disaster and heartbreak; and it's very common these days in the 'adopt don't shop' mindset where people end up with dogs with questionable history/breedings, and then ending up anguished and guilty and feeling at fault when things don't work out and their dog has anxiety, is aggressive around other dogs, is sharp-shy, can't be housebroken, has severe separation anxiety, etc. I see so many people blaming themselves-- they think they didn't know enough, didn't do enough, did something wrong, caused their dog to act this way, etc. when in reality the dog is damaged mentally from the start, and sometimes there ISN'T anything you can do to fix him. It's heartbreaking, but it's not uncommon. Some behaviorists, trainers, and even vets will tell you they can be fixed... but there are times when the damage is just too deep. Can the dog live? Probably. But is it going to be a good life and a happy dog? Probably not. A friend of mine has a rescued Shepherd mix that alternates between sweetness and extreme aggression. She's tried medications, exercise, behaviorists, trainers, paid thousands for an MRI to rule out brain tumors, etc. Nothing helped. The dog is drugged to the teeth and confined to one room of their home. They can't have friends over. They can't kennel the dog and go away for the weekend as the dog is dangerous around strangers. The dog spends her days spinning in circles and barking. She's four years old. Is that a fair life for her or her owners? No. It's not. But so far they feel like they've failed the dog if they put her down, and her vet said 'the dog is healthy' so they haven't been able to do it. One day they may come across the 'final straw' and do what needs to be done, but until then, they and the dog are miserable, and it's so sad to see. They would be a wonderful home for a dog; but this dog is not a sane, healthy dog and they can't enjoy her, nor is she happy.