When you sleep, your muscles relax, including the ones in your throat. This relaxation can cause your airway to narrow, making it difficult for your lungs to inhale and exhale the amount of air you need.
If your airway narrows, the air you breathe is pulled through it faster. This causes the soft tissue in the airway to dehydrate and vibrate. The sound this makes is what you hear as snoring.