Dictionary states that the word みやこ can be written as either 都 or (less often) 京. What factors (nuances of meaning, context, etc.) determine which of the two kanji is more appropriate?
You should almost always go with 都. みやこ is an uncommon and nonstandard (hyogai) reading of 京. Without furigana, 京 is normally read as きょう, and it usually refers specifically to Kyoto rather than capitals in general.
In general, "surprising" readings like 京【みやこ】 are chosen by creative writers to add some flavor to their text. In this case, if you are creating a fictional work set in Old Kyoto, such a reading might be fitting. But ordinary people should not do this without reason.