Technically, twist is the change in the angle of attack from the bottom of the sail to the top. Twist is necessitated by the wind speed changes, hence changing angle relative to the boat as you move ...
Even more significant for the optimization of upwind speed is twist: the vertical shape of the leech. It’s been said that the only reason to have a front of a main is to be able to attach the leech ...