If you're completely new to sailing, it may come as a surprise to you that sailboats can sail upwind, or towards the direction the wind is coming from.
and like a big bag that 'catches' the wind when going downwind.
When you're sailing upwind, or towards the direction the wind is coming from, the sail(s) is acting like an airplane wing in combination with the daggerboard or centerboard to drive the boat forward.
You don't need to understand the underlying physics, but remember: If air is not flowing smoothly from the front edge of the sail to the back edge of the sail, your boat will not move forward going upwind.
How are the sails working when you're sailing across, or at a 90 degree angle to the true wind direction? Across the wind, they act like an airplane wing, just like when you're going upwind (even though you're not!).