When there are hard and soft rocks along a coast, soft rocks get worn away fastest, making bays, while the hard rocks wear away more slowly and are left standing out as headlands.
The size of the bay depends on how much of the coast contains soft rocks.
Bays are more sheltered from storm waves than headlands, and at the back of a bay you will find a beach.