I'm sure someone will correct me if I'm wrong, but in the majority of use cases transistors are used as amplifiers. In this case it could be it's being used as a switch, allowing a small current (the output from say a microcontroller) to switch a larger current (the current required to drive the buzzer).
But it could also be being used to create the signal that actually makes the sound. You can create a simple square wave oscillator using a very simple flip-flop circuit.
So, with the limited information you've provided, I'd say it's being used as a current amplifier to switch the power to the buzzer.