Cross-species capacity for suffering is still under heavy research, but the general consensus is that birds (including chickens) have a comparable capacity of suffering to mammals. This is considered likely true or at least plausibly true for fish as well, though their brains are sufficiently different from mammals and birds that there's still more research going on to understand it more. Animals that likely have no capacity for suffering are bivalves, for example.
It'll take a lot more research to figure out the concrete answer for those in between (e.g. insects, where the latest I've heard is that the most they can suffer is similar to an annoyance or mild pain from a human perspective).
And babies past a few months of age are pretty remarkably intelligent, albeit still a bit uncalibrated.
But if you probe into it, I believe you'll find it's an artificial distinction that rather quickly falls apart. If your moral values ascribe negative value to the suffering of, say, both a human and a dog, then the only consistent viewpoint is to ascribe negative value to any suffering of a materially similar quality -- i.e. what matters on a moral level is the capacity of suffering for the species or individual.
There's a few uncomfortable thought experiments you can think through on this topic. E.g. you can imagine genetically engineering a human as dumb as a chicken, or perhaps a traumatic brain injury causing that, but with their mental capacity for suffering just as intact as yours or mine. Would their suffering count for less? Why would it?
As for chicken vs. whale, it may be the case that a chicken suffers less than a whale. More primitive intelligence may imply more primitive suffering. But what if it doesn't for this case? How confident can you be it does imply that, given both how chickens react to pain and stress and the neurological research that's been done on them? And even if it less, by how much? A factor of two, ten, forty, a thousand?
Those questions may seem too philosophical, but they can't be ignored in the face of a recommendation to eat 40 extremely-poorly-raised chickens per year instead of 1 reasonably-well-raised cow. And given all we know of animal cognition, it's reasonably to assume chickens have a lower capacity to suffer (and also to assume it's the same -- there's still uncertainty), but not so much lower that that calculus is anywhere close to being worthwhile.
A good book on how various animals are treated is Compassion by the Pound[1], authored by agricultural economists. The short of it is that chickens bred for meat are treated very poorly throughout their lives, whereas beef cows are treated reasonably well (with the possible exception of slaughter). Not only that, but you also have to raise far more chickens per pound of meat compared to cows as they're so much smaller, amplifying the effect. It's a far more extreme difference compared than the environmental impact differences.
[0] Some animal welfare activists do so explicitly, whereas others do so implicitly by strictly focusing on chickens. Latter examples are 88% Campaign (https://88percentcampaign.com/) and One Step for Animals (https://www.onestepforanimals.org/). [1] https://www.amazon.com/Compassion-Pound-Economics-Animal-Wel...