She says it's to contain the infection, but she also must have known that everyone she killed would have been reanimated. I mean what's worse than a thousand people infected with a deadly disease? A thousand undead people infected with the same disease, who have no ability to think and insatiable desire to feed. It seems like it would have been much more effective if she just locked down the facility and allowed everyone to live.
The original script by Paul Anderson gives a pretty good description of the Red Queen's decision-making process. I've edited for clarity.
RED QUEEN: I was trying to keep them isolated, but I'm afraid you've changed all that.
TWELVE : Why kill everyone in the Hive?
RED QUEEN : Because there was a leak. T—3 escaped an unplanned pattern of infection began. Once the virus was loose, I couldn’t allow anyone to leave the Hive. So I took the appropriate action.
SPENCE : You butchered them.
RED QUEEN : If one infected human had escaped from the Hive the infection would have spread to cover the United States within 13 days, Canada and South America in 27 days [and] worldwide infection in less than two months. So I took steps.
It's pretty clear that the zombies are actually quite well-contained (electronic locks, deep underground with only a single elevator shaft and an armoured railway tunnel to get in/out) until Alice and her commandos break in and shut down the power, against the Red Queen's explicit advice and warnings...
Although created by the Umbrella Corporation, I do not believe the Red Queen to be evil. Umbrella never intended for the T-Virus to be released within the Hive, so she was programmed to preserve life. When the virus got released into the ventilation systems of the Hive she took steps by eradicating and detaining all those infected so that the virus wouldn't reach a populated area. Upon realizing what had happened, Umbrella took steps to override the red queen, corrupting her and releasing the undead and the virus into Raccoon city above the facility.