There are several different ways. Usually, rocks and other minerals are broken up and worn down into tiny particles. Sometimes, fish poop also contributes to the formation of sand. Sediment can also be carried via glaciers, wind, etc. picking up sediment and dropping it onto beaches before melting and forming bodies of water. Water/waves also could have rubbed particles off of rocky formations and weathered them into tiny little particles.