Odds are real high the owner of that dog was a piece of shit that trained that dog to be like that.
Extremely rare for dogs to just randomly attack humans for no reason, especially little kids. It is almost always a piece of shit human that is behind it. The only exception is "wild dogs", and that is why you need to Spay/Neuter your doggies.