Cow behaviour is a little unrefined at the moment :) So basically they like to eat cereal and straw the most. They're attracted to it more than grass so if they see some they will try to go for it first but if they're inside a pen and can't reach it they just get 'stuck' in the same place and do nothing.
The other thing you're seeing is cows are afraid of the player or any bot holding a stick like tool. You can chase them out of your fields with tools and sticks. So they're probably near a worker that isn't moving away and getting constantly scared of it.
Thanks!