It's controlled by two variables: guntemp_inc and guntemp_dec. Search the forums for a more detailed explanation.
As for why: it was mainly because of the 1-path maps where people would just sit at the only entrance to the base and spray nonstop for the entire round, making the game rather boring. Also, it helps balance the weapons out a little more. Slower weapons can fire a steady stream almost nonstop, while the automatics can fire at a higher rate, but for shorter burst of time. Lastly it adds some additional teamwork and strategy to the game, as it's not as easy for a single person to take on 5 or 6 people at once. It also helps with lag, since you don't have a horde of people spraying nonstop on crowded servers.