The first firearms (e.g. muzzleloaders and muskets) were smoothbored, with barrels that were essentially smooth metal tubes. Towards the end of the fifteenth century rifling was invented, creating spiralled grooves in the barrels that caused the projectile being fired to spin along its axis.
A cutaway cross-section through a 105-millimetre tank gun, showing the barrel’s rifling.
A projectile that spins along its axis is gyroscopically stabilised and therefore more aerodynamic and accurate; for example, the stabilising effect of the spin prevents the projectile from “tumbling” in flight. Short, large-diameter projectiles (e.g. lead shot) require only low twist rates, whereas longer and thinner projectiles (e.g. rifle rounds) require faster twist rates, one turn per twenty centimetres or more.
In some cases the twist rate will increase down the length of the barrel, this is known as gain twist and helps reduce wear and tear on the barrel.
You’ve shown remarkable restraint not to mention 007 in this post.