He's got a great attitude and scores goals. He's a real good centre-forward.Harry Redknapp
The 6ft 4in Southampton player was wanted by seven clubs, according to Harry Redknapp, and there was late Premier League interest.
But the highly-rated 21-year-old has opted to join Blues and becomes the manager's eighth signing of the summer transfer window.
Redknapp said: "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."
Gallagher will wear squad number 18.
He has not been registered in time to figure in Tuesday's Carabao Cup tie, but he will be eligible for both domestic cup competitions thereafter.
Born in Crediton, Devon, Gallagher was in Plymouth Argyle's youth academy - a contemporary of Isaac Vassell - before the Saints snapped him up in April 2012.
He made his debut seven months later and went on to appear 18 times in the Premier League, scoring once.
He was recalled from a six-month loan spell at MK Dons in January 2016 and the next season went to Blackburn Rovers on loan for the season.
Gallagher impressed in a struggling Rover side that got relegated, scoring 11 times in 42 Championship appearances.
He signed a new four-year contract with the Saints this July.
Gallagher represented Scotland at Under-19 level before switching to England in 2014.