When people talk about someone throwing them a curve ball, they are usually discussing some kind of intentional attempt to surprise. A single person or a group can throw a figurative curve ball, and sometimes the idiom can even be used in other contexts to describe completely random events, although those uses are often tinted with irony. The very nature of the term suggests that the individual using it had some kind of particular expectation about upcoming events, and usually a plan as well, which was probably dashed when events unfolded in an unexpected fashion.
The use of this idiom comes from baseball and the strategy used by certain pitchers. In many cases, pitchers rely on the speed and movement of their pitches to fool batters, and the whole game between the hitter and the pitcher is generally a matter of expectations. The hitter will often try to guess what the pitcher will throw next, which can give him an advantage in hitting because of timing and expectations about how the ball will move. Usually, the pitcher tries to do everything he can to make the batter guess wrong about the next pitch, keeping his motion identical from each pitch, and changing his pitching patterns. So a curve ball would ideally tend to be thrown at a time when the batter is expecting a fastball, and the pitch will generally disrupt the batter's timing while simultaneously causing him to miss with its unexpected movement.
Just like in baseball, when people talk about a curve ball in real life, they are usually referring to a situation where they guessed wrong about upcoming events and were fooled by a clever opponent. For example, if a company priced their products based on the current prices of their competitors, only to discover that the other company had a new less expensive product in development, that might be seen as a curve ball from the strategic perspective of the first company. In most cases, the use of the term suggests an element of being caught unprepared or preparing for the wrong kind of event.
Another aspect of the idiom is that there is usually the suggestion of a deliberate attempt to mislead. If people feel that they’ve been thrown a curve ball, there is often a sense that someone else tried to coax them into making a bad move. This can often even suggest a negative connotation or imply a lack of ethical behavior. There are other cases, however, where a curve ball could even be a good thing. For example, if someone had braced for bad news, and got good news instead, that could also be a curve ball.