In terms of a bullet's trajectory and why it spins, the secret lies in the interior of the bore - it has a spiralling cut through it.
If you ever look at a cross section of a barrel, you will see a series of spiralling cuts inside the bore. This is called rifling (where the term Rifle comes from.) Basically you make the windage (the gap between bullet and bore inside the barrel) as small as possible to focus the bullet's trajectory in a certain direction, and the bullet will engage itself on the spiralling cuts, causing it to spin. By spinning, it practically drills through the air, allowing it to break the sound barrier easier, accelerate faster, cut through the air easier. The result is that once it exits the muzzle it is as fast as possible. Furthermore, by cutting through the air easier, it travels a better trajectory and travels faster (thus more accurate and straighter, and higher penetrating,) and further (due to increased velocity.)
Prior to rifling becoming widespread (though it has existed since the 1500's) all firearms were smoothbore - there is no rifling inside the bore and it's pretty much just a tube. Whilst it was cheap to make and quick to load, firearms were inaccurate. Rifles did exist, though they weren't used by the military extensively for many centuries to come because rifles were expensive to make and slow to load (this is the time of muzzle loaders were you load down the barrel of the gun, and only get one shot per barrel, Rifles were hard to load because the windage is very small and hard to ram a ball down into the powder charge.) If you've ever seen movies like, "The Patriot," there is a scene where the Continental Army and Redcoats engage each other out in a field - they march in shoulder to shoulder to close range, then start firing. This is how armies fought each other from the 1500's till about the early 1800's, because their smoothbore muskets were only accurate to ranges of about 50-70m and they would all fire together at once, to increase their chances of hitting a target.
This idea worked for hundreds of years, but Rifles still saw occasional use. A good example is in the American Revolutionary War in which American Minutemen would use their Rifles (which could be accurate out to 200-300m compared to Smoothbore Musket's 50-70m) to just shoot the Redcoats before they were in range, then run away and reload to repeat again later on. Once Rifling became able to machined easily rather than requiring skilled gunsmiths (which were few) they began to see more common use, until finally in the mid 1800's the Smoothbore Musket disappeared in favour of the Rifle.
Rifles proved more accurate, longer ranged and more deadly. The ability to make a projectile spin is why they are so effective.