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.

3 October 2016 Last updated at 13:34 BST
Greater Ardoyne Residents Collective (GARC) supporters, including spokesperson Dee Fennell, confronted the high-profile priest after the Orange Order Parade passed the Ardoyne shops.
A small crowd of protesters accused him of taking sides with Sinn FÃ©in and the Orange Order against a majority of local residents.
Fr Donegan has ministered in the Ardoyne area for the last 15 years, and is due to take up new duties next week at the Tobar Mhuire retreat centre in Crossgar.

Earlier in the morning we saw a number of airstrikes in the Old City. Iraqi forces were still pinned down by snipers from the group that calls itself Islamic State.
Colonel Jabbar Abad told us it was the last pocket of resistance. He claimed they would be defeated within hours.
His troops helped a steady stream of civilians fleeing to safety. Mostly women and children. Their faces were haunted and some had to be helped.
The children didn't even flinch when there was more sound of gunfire. An older woman was so weak she could barely walk. A few babies being carried looked almost lifeless.
The families were given food and water. This, their first taste of freedom after three years of living under IS control. The battle briefly forgotten in their own fight for survival.
If this is victory it has come at a huge cost. Not just in human life. Nearly everyone rescued had to leave dead relatives behind.
Almost every building in the old city has been scarred or completely destroyed.
Search and rescue teams are still pulling bodies from the rubble. The heat has contributed to the stench of decaying corpses.
We met Ali, who had come to find his brother's family. Hoping against hope that some may have survived.
He said IS fighters had been using their house when it was hit by a coalition airstrike a few weeks ago. Iraqi security forces had only recently taken the area.
With tears streaming down his face, Ali held up his mobile phone and told me he'd spoken to his brother trapped under the rubble. But over the last few days there had been no reply.
Ali helped the search and rescue teams make their way through the tonnes of rubble.
They tried to console him when all they could find what must have been their remains, which they carried off in a black zipped bag. We watched them do the same at several other sites.
Contrast that with the jubilation of the Iraqi security forces who mobbed Prime Minister Abadi as he arrived in the city to declare victory over IS.
This is still a significant moment. The extremists have held the city for three years. It's taken nine months of brutal street to street fighting to dislodge them.
This was their stronghold in Iraq. It was here, in the city's now flattened Great Mosque of al-Nuri, where their leader, Abu Bakr al-Baghdadi, made his one and only public appearance as Caliph of their so-called state.
For many IS fighters Mosul is their graveyard, though it is still likely that some have escaped.
The misery of Mosul is far from over. The UN estimates it will cost at least $1bn (£0.77bn) to restore the city's basic infrastructure - such as clean water and electricity.
It will take tens of billions more to rebuild this city.

The young woman and her diving buddy were exploring the wreck of sunken cargo ship near Lochaline.
She was rescued at 11:16 by Oban's RNLI lifeboat, whose crew included a doctor with experience of working with divers in similar situations.
She was taken to a waiting ambulance in Oban, then transferred to a recompression chamber at Dunstaffnage.
Birmingham City have signed Dundee forward Greg Stewart on a three-year deal for a fee believed to be around £500,000.
[NEXT_CONCEPT]
Fr Gary Donegan was confronted by a small crowd of angry protesters following Saturday's Orange Order march in north Belfast.
[NEXT_CONCEPT]
Even while the Iraqi prime minister was on his way to Mosul to declare the liberation of the city, there was still the occasional sound of gunfire and coalition warplanes flying overhead.
[NEXT_CONCEPT]
A diver has been rescued from the Sound of Mull by a lifeboat crew, after suffering from the bends.