A.K.
This happens. I don't understand a two-year-olds mind well enough to understand why.
My pediatrician recommended 'poop friendly snacks' such as dried prunes, grapes, high fiber cereals (like those little circles made of nothing but bran) and LOTS of water. This made him have to go so quickly he couldn't hold it for long. The food sounded kinda icky to me, but my son thought it was good and it helped him not hurt himself.