This other man was actually Malcolm's brother, Donald. Donald's activities for years prior to claiming the throne is unknown, because he was hiding in Ireland. Donald's father was Duncan, King of Scotland from 1034 to 1040 when he was killed (and succeeded by) Macbeth; yes, that Macbeth. Shakespeare has the boys old enough to manage this themselves:
Malcolm: “What will you do? Let’s not consort with them: To show an unfelt sorrow is an office which the false man does easy. I’ll to England.”
Donalbain:* “To Ireland, I; our separated fortune shall keep us both the safer: where we are, there’s daggers in men’s smiles: the near in blood, the nearer bloody.” [Macbeth, III,3]
Both the boys were very young in reality (Donald about seven). It is more likely that Duncan, when he was about to face Macbeth's rebellion, sent his sons away for safety himself.
Donald would have been 25 years old when Malcolm killed Macbeth and took the throne back into the family. Even with the family back in charge, we do not know exactly what Donald was doing or if he returned to Scotland. After the 1093 Battle of Alnwick and the death of the king and queen and immediate heir, he was able to come forward and present himself as the obvious choice for kingship.
This may not have been as radical a "coup" for Scotland as we might think. Although Malcolm and Margaret had a very successful marriage, Margaret may not have been the favorite of Scotland. She worked to change the Scottish church to bring its practices closer to what she grew up with on the continent. She was one of the last Anglo-Saxon princesses, and gave refuge at court to Anglo-Saxon exiles fleeing the Normans who had taken over England. She also broke tradition and gave Anglo-Saxon names to her children, rather than Scottish names.
John of Fordun (1360 - 1384, so not a contemporary) wrote that Donald came to Scotland "at the head of a numerous band" and besieged Edinburgh with Malcolm's sons inside. He adds that Edgar Ætheling (Malcolm's brother-in-law) took the sons to England. The Anglo-Saxon Chronicle says that Donald expelled all the English from his court.
So Donald was King of Scotland. It's a nice job...if you can keep it. Let's see how well he did at that. See you tomorrow.
*Donalbain = "Donald the Fair"