The Gemara in Berakhot 26b establishes the two windows for Mincha — mincha gedola beginning at six-and-a-half hours after sunrise, and mincha ketana beginning at nine-and-a-half hours — grounding both in the timing of the daily afternoon offering in the Temple.
the Rambam (Mishneh Torah, Prayer and the Priestly Blessing 3:1–4:2) rules that the primary, preferred time for Mincha is nine-and-a-half hours (mincha ketana), since that was when the afternoon offering was brought every day, with six-and-a-half hours (mincha gedola) serving only as a post-facto option — and the Beit Yosef (Orach Chayim 233) explicitly draws out this distinction, noting that according to the Rambam davening at mincha ketana is the lechatchila ideal.
the Tur (Orach Chayim 233) records the unresolved machlokes between the Rabbis, who permit Mincha all the way until nightfall, and Rabbi Yehuda, who holds it must be done before plag hamincha (one-and-a-quarter hours before nightfall), and rules that one must be consistent — choosing one opinion and not mixing them with Maariv.
Beyond the technical times, Berakhot 6b urges special vigilance with the afternoon prayer, citing the pasuk in I Melachim 18:36 where Elijah's prayer at the time of the afternoon offering was answered — lending Mincha a particular spiritual weight that goes beyond simply meeting its deadline.