
On Earth, we have weather because we have an atmosphere. Electromagnetic radiation from the sun heats up molecules and gases in the atmosphere, which causes the dynamic weather systems that cover the globe on a daily basis.
Perhaps counterintuitively, there is also weather in space, which is generated by the sun's activity — for example, the solar wind, the stream of charged particles flowing continuously from our star.