This is he who “rules the roost,” who permits no doubt of his supremacy.
The figurative use is so common, especially as applied to a young dandy strutting along the sidewalk, that we are not likely to wonder why a rooster would be upon a promenade nor how long its cockiness would last if it were.
But, especially in England, “walk” has a particular application. It means a place set aside for the feeding and exercise of domestic animals; or, in this instance, a chicken yard.
The literal cock of the walk, therefore, is the rooster in a given chicken yard. The figurative expression seems to have been in use little more than a century.