The Championship outfit have claimed that they have "beaten off strong competition" from seven clubs to nab the 21-year-old's signature.
Gallagher joined Southampton in 2012 and went on to make 18 appearances in the Premier League for the Saints, scoring one goal.
When asked about the deal, Birmingham manager Harry Redknapp told the club's official website: "Delighted. I think he's a good centre-forward. He's got a great attitude and scores goals.
"Believe me, there were a lot of clubs who wanted him. I think he's going to be great for us."
The forward has spent the last two seasons on loan at MK Dons and Blackburn Rovers respectively.