Sometimes green poop does signal that your baby isn't feeling well — but the green color itself isn't the problem. It's usually a side effect of faster-than-usual intestinal transit.
When babies have a stomach virus (gastroenteritis), a cold, or are teething heavily, their digestive system can speed up. Increased saliva from teething gets swallowed and can irritate the gut. A viral infection can inflame the intestinal lining. In both cases, food moves through faster, bile doesn't fully break down, and you get green stool.
Teething-related green poop is especially common and especially harmless. Babies produce enormous amounts of drool when teeth are coming in, and all that swallowed saliva can loosen stool and give it a greenish tint. If your baby is drooling buckets, chewing on everything, and has green poop, teething is the most likely explanation.
A stomach bug is a different story. If green poop is accompanied by vomiting, fever, refusal to eat, or very watery diarrhea (significantly more liquid than your baby's normal stool), call your pediatrician. The concern here isn't the color — it's the risk of dehydration from fluid loss. Keep offering breast milk or formula frequently, and watch for signs of dehydration: fewer wet diapers, dry mouth, no tears when crying, or a sunken soft spot.