Killing a dog for being a dog is ridiculous.
Dogs instinctively set up an invisible "fight or flight" boundary around themselves. The size of this boundary depends on his level of confidence and tolerance. A fearful dog will give itself a wider area than a more stable one. When someone who the dog perceives as threatening or unwelcome enters that area, the dog has two choices -- it can run away or it can defend itself. If it feels that it can't run away, it will fight instead, no matter how afraid it might be. Some dogs will choose to fight first, rather than run.
A small child that's petting or hugging a dog has already intruded well within the dog's flight or fight boundary, the dog's safety zone. If the dog has tried to leave or has issued a warning with no response from the child, the dog (in his mind) has no other recourse -- he bites. This is normal, instinctive behavior -- to the dog. He is responding to what he perceives as a threat and is doing what his instincts tell him to. Remember that dogs don't think in the same way that people do. A child's innocent action, petting the dog, can be provocation for a bite when seen through the eyes of the dog.
There are other circumstances that can provoke a dog to bite a child. Running, playing, screaming kids can trigger an instinctive predator-prey reaction in some dogs. Children who rough house and wrestle with dogs unknowingly encourage them to use their teeth. Dogs equate this kind of play with littermates or other dogs where using teeth is allowed. Startling a sleeping dog or petting him when he's eating can also provoke a bite.
The child is new; the dog is showing his dominance over the baby. I see this all the time with my dogs. When I got a German shepherd puppy my other German shepherd for no reason bit the pup, to let the pup know that he was the alpha dog. I immediately beat my dog and scolded him for it to let him know that I was the boss and he never went after the pup again. When my wife and I had our child. I introduced the baby very slowly and under close supervision. Both my dogs stayed on their leash and my wife held on to them. When my dogs did something that was to aggressive we would do what’s call a snap release on the dog. After about 2 weeks we let the dogs be in the same room with our son. We would be watching TV, and if the dogs got to aggressive I could just say no in a sharp voice and they would stop. My son is now 20 month old and he and the dogs get along great. Those dogs would kill someone if they tried to hurt him. So my point is that the dog is not to blame here, he was just doing what dogs do. With proper training and discipline the dog will be fine with a child. I have had dogs my whole life. I have been bitten by my dogs before but it only happened once and after that the dog knew better then to even think about biting me again. It comes down to the owner being the Alpha dog and the dog respecting your authority not the other way around. When you see people getting pulled around by their dog on a leash the dog is in control and the alpha, that’s wrong. My dogs don’t need to be on a leash because they are well trained and listen and know not to walk more than 5 feet in front of me.