Birds don't attack anyone or thing without reason. Usually, this is being close enough to nesting areas they feel threatened.
Growing up, our problem birds were the blue-jays, too close to where they nest, they start by chattering and then swooping you. Sometimes pulling hair out or pecking to the point of drawing blood. They are not mean birds, just protective of their nest.
Happens with magpies now and then, and those can cause some good injury like crows or raven.
On the pier, people have fed the pelicans so much they expect it, and ignore them, they can peck at your legs and draw blood. Food is their motivation.