Suns energy is heat energy. This heat increases the heat in some point and hence the air temperature increases. So air flows up at that position. So cold air from other position goes to that point. And hence a local wind is generated. Also irregularities in the earth surface also play a very important role in case of local wind.