The actual "man who would be king" of the title can refer to either of the two vagabonds, Peachey Carnehan, or Daniel Dravot, in Rudyard Kipling's story, "The Man Who Would be King", as both of them were, in fact, sought to be and were crowned as kings in the fictional country of Kafiristan.
The meaning of the phrase is simply "the man who wanted to be a king". On a literal level, thus refers to the fact that at the beginning of the story, when the narrator first meets the adventurers, they are plotting to become kings in the future. It is only after three years have passed, and the narrator encounters Peachey again, that we discover that they indeed succeeded at their ambition, albeit only briefly.
Figuratively, this refers to ythe grandiose ambitions of imperial Britain, in which even petty civil servants can be "king-like" in power over the natives.