I've heard that sentence here, as an example for the future perfect continuous.
The chicken will have been cooking for an hour.
The chicken is the subject, does it cook itself? Is it possible to say such a thing?
Yes. The verb "cook" can be used in this way.
1.1 no object (of food) be heated so that the state required for eating is reached.
‘while the rice is cooking, add the saffron to the stock’
"bake", "boil" and "fry" can be used in the same way. Maybe other "cooking" words can too.
1.1 no object (of food) be cooked by baking.
‘the bread was baking on hot stones’
1.1 (with reference to a kettle, pan, or other container) heat or be heated until the liquid inside starts to boil.
with object ‘she boiled the kettle and took down a couple of mugs’
no object ‘the kettle boiled and he filled the teapot’
1.1 no object (of food) be cooked in hot fat or oil. ‘put half a dozen steaks to fry in a pan’
The chicken is cooking in the casserole. The bread is baking in the oven. The egg is frying in the pan, and the water is boiling in the kettle.
2 : to undergo the action of being cooked
// the rice is cooking now
"cook" is one of those verbs where the object and subject can be interchanged. Other examples are "fail" (the teacher can fail a student, or the student can just fail) and "burn" (a fire can burn a house, or the house can burn).
You would say this in a scenario where, for example, you are cooking a meal. You are planning out the meal and the timing is important so everything will be ready at the same time:
When the potatoes are done, the chicken will have been cooking for an hour.