I copy pastad this little simple explanation:
Sailing into the wind is possible when the sail is angled in a slightly more forward direction than the sail force. In this aspect, the boat will move forward because the keel (centerline), of the boat acts to the water as the sail acts to the wind...