I met several hikers on the trail who despite using the chin straps on their hats, had their hats blow away.
Using the same technique I used to keep my umbrella from blowing away, I secured my hat to my shirt: I unbuttoned a button on my shirt, wrapped the chin strap around it, and re-buttoned it.
If your hat doesn’t have a chin strap, a “cap leash” will keep your hat from blowing away.