The sun shines on the planetary sphere directly overhead during the daytime in the tropics and more obliquely nearer the poles. Consequently, it heats the ground, or sea, more in the tropics than nearer the poles. In turn, the hotter surface warms the air more over the tropics than does the cooler surface nearer the poles. This leads to convection over the tropics and warming of the atmosphere in depth. Given more or less uniform pressure at the surface, pressure falls off more slowly with height in warm air than in cold, denser, air. This means that at some height, say 18,000 feet (say 5km) pressure will be higher over the equator than nearer the poles. This causes winds to become more westerly with height in both hemispheres. As vectors, the upper wind is the sum of the lower wind and the, so-called, thermal wind.
But, temperature gradients, mountains and the distribution of land and sea disturb the idealized flow, distort the horizontal temperature patterns , concentrate the gradients (and so the thermal winds) and strengthen the winds aloft. In extreme cases, this results in jet streams. (Above the jet stream, the temperature gradient is reversed and so the wind falls off with height.)
Now the atmosphere is three-dimensional and varying in time. Some areas near jet streams encourage air to ascend from below and so help develop low-level depressions beneath them. Other areas of the jet favour sinking air aloft and so the development of anticyclones. The winds around these new features distort the average temperature in-depth patterns and so on.
The way I've told the story suggests that the height of the 500mb (or hPa) surface ― and the thickness of the 1000-500mb layer ― are the chicken and the jet stream the egg. However, we never have a fresh start. The race just goes on for ever. The jet stream and the distributions of temperature and pressure are always closely related, but small changes in one or both grow to make other changes in both. Feedback.
Think of a simple internal combustion engine, with a cylinder, mixture of air and petrol, piston connected to a crankshaft which turns a flywheel driving a dynamo to provide a spark in the cylinder. When the engine is running, you might say the flywheel keeps the engine turning so that air and petrol enter the cylinder and drives the dynamo that generates the electricity to make the spark to cause the explosion which drives down the piston and keeps the flywheel turning. But you can take different parts of the engine and see them as either chicken or egg. From the flywheel's point of view, for example, the spark could be the chicken – or so could the petrol and air. Or, alternatively, I the flywheel am the chicken. From the piston's point of view, unless I come up, cause the petrol and air to come into the cylinder and let the spark explode them, nothing happens: I'm the chicken. And so on. We have a continuous internally consistent process. There is no chicken and no egg ― it's a wrong analogy.
By the way, it's an interesting fact that for any pattern of winds at any moment, it is only the differences between the corresponding theoretically consistent distribution of pressure at that moment and the real pressure distribution at that moment (the so-called ageostrophic component) that cause our cloud, rain and snow.