You correctly identified that switching to the knife is done for speed. But why do they switch so often? There is a reason for frequent switches in case of highly skilled players.
Note: I didn't play much Counter Strike, but I played a similar (Wild West-themed) game on a relatively high level.
You correctly stated the question: why switch so often?
The answer is, for professional or highly skilled players playing against similarly strong opponents, that there are many situations where you couldn't do anything even if you had a gun, so in all those cases better have a knife because you move faster.
Why?
Because the following is a very suboptimal way of traversing the map:
If you run around the map like this, and your opponents are really good, you have zero chance of surviving. Zero.
At first it would seem logical. Enemies could pop up from either A or B, so you keep the crosshair between the two, as you have the shortest distance to rotate to either side. But then an enemy pops out, and before you can move the crosshair even a little, you are dead.
The correct way of running around the map is to pick either A or B, and run so that your crosshair is exactly on the spot where you could shoot without moving your aim even a pixel, if someone happened to come from that direction. How to choose? If you know the map well, know the shortest distances from any point to any other point, keep track of where your enemies were sighted last, where you have heard gunshots from the last time, you form a mental map of the likeliest locations the enemies might be at or might move towards. Especially in the early game, if you know the map well, you know at how many seconds after the start which positions could have already been reached by your enemies and which couldn't have.
If you picked wrong, and an enemy pops out from the other direction, you have to either duck back to cover, run to the next cover if available, or start evading. Because if you try to turn and shoot, and your opponent is really good, you have no chances: he had you in his crosshair sooner (actually, he had you in his crosshair even before you became visible), so you die.
You know you are good, when novice players start accusing you of using wallhacks, because you keep shooting them instantly as they appear, before they could react, as you run around while aiming your gun exactly to the most likely location someone could pop out from.
Yeah, but what does this all have to do with the knife?
The main thing is, against professional players, if your gun isn't already pointing to the exact corner your enemy is coming from, most of the time there is no point in trying to correct your aim and shoot, as your opponent will shoot you first. So in any case where you move from one place to the next, run from one cover to the next, or basically any occasion you aren't aiming at the exact corner where you could kill your opponent if he just happened to come from there, your gun is useless. During this time, if you have a knife equipped, you move faster. When playing among professionals, reaching a location fractions of a second sooner might be the deciding factor between victory and defeat.
Other causes
Some less skilled players have seen what better players do, and emulate it without understanding why, without applying these tactics correctly. Or they are bored and do it for fun.
CS might have some exploits of interrupting some animations, that might be another cause, but I don't know CS good enough to know. The above explanation can be valid for several games, where running with a knife (or fists, or whatever melee weapon) is faster than running with a gun.