If you are sailing parallel with the wind, the wind pushes against the sail and the sail pushes back on the wind, and the wind "wins". Therefore the boat moves in the direction of the wind. Plus, irregular air pockets are made like 'imprints' in the sail so that air pockets help to propel the boat. If the boat didn't have sails, it would be carried by the water, but since the sail traps the air and serves as a resistance to it, the air pushes the boat. A sailboat sailing directly against the wind is physically impossible.