It’s all pretty complicated, but to try and put it in simple words, a snowflake forms around a dust particle and attracts water droplets. They freeze in a crystal form as the flake moves through the atmosphere.
The differing temperatures and humidity give the snowflake varying shapes.