The origin of the term comes from early- 19th century muggers who would fill hidden compartments in the large cuffs of overcoats popular at the time with sand. Apparently unarmed, they could knock out an unsuspecting victim with one heavily-weighted blow to the head.
This trick of deceiving others as to their true potential later came to be applied to any contest where someone deliberately underperformed in order to lure the "mark" into a large increase in the stakes and then showing their real strength. In chess it means someone who deliberately loses a bunch of games at the local chess club or inexpensive small tournaments in order to lower their rating and fall a couple of classes to have a good chance of winning a class prize in a big-money tournament.
The US Chess Federation has rating floors below which a player's rating cannot fall (about 200 points below best rating), so someone with a 1975 best can never be rated below 1700. Still, a player whose actual strength is about 2100 can be careful to start losing when their rating nears 2000 and then sandbag their way back to the B class for a shot at the good $$. Not much can be done about such behavior--anyone who has played for a few years knows that there are times when you just aren't in good form and will lose a lot of rating points for a while.

It's when people fill bags with sand in expectation of a storm where water is expected to be a problem. They place these bags of sand strategically to address the water danger, so sandbagging can be a good thing. That's where the term sandbagging comes from.