It is not uncommon to see chickens running free in the grounds of shrines, like these first two photos in Aoiaso Shrine, Hitoyoshi.
Some say it is because the rooster heralds the arrival of the sun, the sun goddess Amaterasu.
Some say it is because in the Iwato myth the assembled kami brought in roosters to try and trick Amaterasu out of the cave.
This third photo is from a small shrine next to Suwa Shrine in Nagasaki.
These last two photos are from Iminomiya Shrine in Chofu, Yamaguchi.
Personally, I think the reason you find chickens at shrines is because the priest and family like free eggs.