Penguins can not fly because their feathers are water proof, which helps them gluide through the water. Penguins can't fly because some birds that can fly plucked the penguins feathers that helped them fly. So all of the penguins can do now is swim to catch fish and gluide on the ice.
So the penguins got revenge on those bird, by plucking their feathers that helped them fly too. So now the pecok cannot fly, the ostridge cannot fly, and some other birds too. That's how all the flightless birds came to be.