He had rejected a move to Birmingham on Wednesday but has now agreed personal terms and passed his medical.
Stewart, who was in the final year of his contract at at Dens Park, had scored six goals in three games for Dundee already this season.
He could make his Blues debut in Saturday's Championship match at Leeds.
Stewart is Birmingham's second signing of the week following the arrival of striker Che Adams from Sheffield United.
Birmingham opened their Championship campaign with a goalless draw against Cardiff City and were knocked out of the EFL Cup by League One side Oxford United in Tuesday's first-round tie.
Birmingham City have signed Dundee forward Greg Stewart on a three-year deal for a fee believed to be around £500,000.