Air rising in thunderstorms can begin to spin when it's affected by winds blowing it in different directions. It starts to rise and is pushed to the side by wind. It rises a bit more and is jostled again by wind moving in another direction. Winds moving in different speeds and directions at different altitudes cause the rising air to start spinning.
Air that spins as it rises is typical in supercells, the strongest type of thunderstorm, but not all spinning air creates a tornado.
For a tornado to form, there also needs to be spinning air near the ground. This happens when air in the storm sinks to the ground and spreads out across the land in gusts. Gusts of warmer air rise as they blow. Gusts of cooler air sink as they blow across the land. If there are enough rising and sinking gusts, the air near the ground starts spinning.
The spinning air near the ground speeds up as it’s drawn inward toward its axis of rotation. This happens in the same way that figure skaters spin faster when their arms are drawn in rather than when their arms are outstretched. This is called conservation of angular momentum.
The rotating air moves horizontally across the land, and can be tilted vertically by the force of the rising, rotating air. That allows a tornado to form.
Most tornadoes form during supercell thunderstorms, but not all supercell thunderstorms produce tornadoes. Usually, the rotating air near the ground doesn't rotate fast enough, for a tornado to form. If the rotating air near the ground is very cold, it will spread away from the storm along the ground and slow down like a figure skater with extended arms, and a tornado will not form.