The fact that we have weather at all is dependent on the existence and nature of Earth's atmosphere. A unique feature of the blanket of air that envelopes our planet is the presence of water vapor, and a temperature profile that makes it possible for this water to exist in three forms: gas, liquid, and solid.
The term weather technically refers to the daily variation of conditions in our atmosphere. What we experience on the ground can be measured by recording temperature, humidity, windspeed, precipitation type and amount, and other aspects.
The sun is the source of these variable atmospheric conditions. The sun affects our atmosphere in different ways depending on global location. Land areas heat up (and cool down) more rapidly than oceans. Regions located at the equator get more intense solar radiation than areas at Earth's poles.
Earth's atmosphere is a huge complex system, and like most complex systems, it tries to maintain its own equilibrium. Warm air from the equator is funneled outward towards the cold polar regions. But air movements are also affected by friction with land and the Earth's rotation. The whole system is confined to a relatively narrow space by Earth's gravity.
The combination of irregular heating, Earth's attempt to balance out the irregularities, the effect of geography, and the forces of rotation and gravity produce incredibly complex patterns of high and low air pressure. These areas of high and low pressure interact with each other and with the ground to produce ever-changing and sometimes unpredictable weather conditions.