Chicken can fly to some extent, they fly short distance and not for long, they are bad at flying this is because they're adapted for spending time on the ground.
Chickens have wings because their ancestors had wings. Chickens are heavier birds, their wings are too light to carry a chicken in the air for long. There are structures to live on the ground.
It is a known fact that chickens cannot fly as high as other birds. Some people assume that they cannot fly at all but this is not true. Chickens cannot fly like other birds because of how human beings breed them to be. They are meatier than other birds because they are meant to be slaughtered and consumed by people. If they would not have enough meat, then people will not be able to eat anything from the various chicken pieces that they will get.
Chicken have wings because they can fly though not as high as how their ancestors probably did. Wings may not be too useful to them as compared to the wings of other birds but the wings can still help them escape from predators.