The transport of sand and pebbles along the coast is called longshore drift.
The prevailing wind (the direction the wind ususally blows from) causes waves to approach the coast at an angle. The swash carries the sand and pebbles up the beach at the same angle (usually 45º). The backwash, however carries the material back down the beach at right angles (90°) as this is the steepest gradient.
if a pebble was placed in the water it would be carried along the coastline in a zig-zag motion and would eventually be deposited when the waves lose energy.
The general direction of longshore drift is decided by the prevailing wind. In the diagram below the prevailing wind is approaching from the south-west. Therefore longshore drift is moving material from the west to the east.
Remember - when we describe wind direction we use the direction it is blowing from not blowing to.
This video shows how longshore drift works