Since dog chew and eat almost everything they find, it is very common for them to suffer from diarrhea afterwards.
Even infections can cause loose stools which indicates diarrhea, but mostly it occurs because of a sudden change in the diet, eating table scraps or even from swallowing small objects. Note that diarrhea can sometimes be accompanied by vomiting. But if his diarrhea is severe and happens frequently you might have to check with the vet for any food allergies, intestinal parasites, bacterial infection, metabolic problems or tumors.
When you dog is showing signs of diarrhea, whether it is accompanied with vomiting or not you should remove his food bowl and give him only water for the next 12 hours. Initially when you introduce food again give him white rice with cooked chicken until his stool consistency returns to normal. If after 24 hours of home remedies he does not show signs of improvement you must take him to the vet for a fecal exam to find the diagnosis.
It would help prevent it if you do not suddenly change his diet, don’t give him bones or small objects to play with. Also it is important not to feed him table scraps or allow him to scavenge.