Chickens have wings because they are birds, and birds by definition have wings. That the wings of chickens don't allow them to fly very well is irrelevant to their classification as birds.
Other flightless birds from history include the dodo, the moa and the elephant bird, which are now extinct. Extant flightless birds are the ostrich, the emu, the rhea, the cassowary, the kiwi and an odd New Zealand parrot called the kea. For some of these birds, such as the kiwi and the emu, the feathers resemble hair or fur more than feathers.
While the penguin also cannot fly through the air, its wings have been modified into appendages very much like flippers. These flippers allow the penguin to swim effortlessly under water in order to catch fish more efficiently.
Scientists believe that some birds are flightless because they live in areas where there aren't many predators. Other flightless birds are big, such as the ostrich, and can defend themselves, their offspring and their territory.
The ancestor of the chicken is the red junglefowl, which originated in Southeast Asia. This bird can fly, but tends to restrict its flying to avoiding predators and reaching its roost in the trees.