Why no ashrei in maariv, despite its importance? Also, why in shacharit twice? (Perhaps these are related questions.)
Loewian already cited Talmud Brachot that explains the source for citing it 3 times daily. However this Beurei Hatefilah article cites several commentaries that state that it really should be cited once daily. I don't want to occupy space here pasting an excerpt, as it's tangential to the O.P.'s question.
Pnei Yehoshua on Brachot 4b says:
Rabbi Eleazar said and Rabbi Avina said: Anyone who recites Psalm 145: Tehila L’Dovod each day, three times per day, is promised a place in the Next World. It appears that the intention of this rule is that if one recites this prayer with the proper thought three times a day, it becomes a Chazaka. His faith will be strengthened in his heart because the whole world was created only so that we spend time learning Torah that was written in the 22 letters of the Hebrew Alphabet that are in this psalm. And everyone was created for that purpose. Three times a day one should concentrate on the meaning of the verse: You open your arms and feed all living beings. This means that G-d feeds his whole world from the horns of the wild oxen to the eggs of the bugs. All of them are nurtured with little effort and without pain as it is written earlier in Psalm 145: The eyes of everything look to you and you give each one his food at the right time. It follows from that rule that a person should make his work secondary and his work for G-d primary as our Sages taught us that those who follow that rule with have this and that happen to them. This is also what is meant by the gemara’s statement that he is guaranteed a place in the Next world. Based on this it is easy to understand why the three times that we recite Ashrei are during the daytime and none are at night as part of Maariv. The reason is that the majority of time that a man spends in his vocation is the time after the morning prayers, as it is written: A person goes out to his work until evening meaning until after the time to recite the afternoon prayer.
As we see below from the OU the reason is that we do not have chazaras HaShatz (repetition of the Shmona Esrai) as part of Ma'ariv. As a result, there is no kedusha in the prayer. Thanks to @Lee for stating that this is based on the Maharsha.
It is evident that the Sages intended to link Ashrei with the reciting of Kedusha, because Kedusha always follows Ashrei. The first Ashrei is in Psukei Dezimra, which precedes the Kedusha of Et Sheim and the Kedusha of Shemoneh Esreh, the second is before Uvah Letzion, the final Kedushah of Shacharit, and the third starts the prayer of Mincha which leads into the Amidah and Kedusha. Since Maariv does not contain a Kedushah, we do not recite Ashrei then.
We can connect the three times we say Ashri (twice in Shacharis and once in Mincha) to the three times that we daven, but that is a different matter.
The custom to recite Ashrei thrice daily seems to be based on the gemara in Berachoth 4b
אמר רבי אלעזר א"ר אבינא: כל האומר "תהלה לדוד" בכל יום שלש פעמים מובטח לו שהוא בן העולם הבא
R' Eleazar son of R' Abina said: Whoever recites "Tehilla l'David" three times daily may be assured that he is a person of the world to come...
The only tefilloth (prayers) that are a chova (obligation) daily (at least originally when Maariv was still treated as a tefilath reshuth [optional prayer]) are Shacharith and Mincha. As such, these three recitals needed to be distributed between these two services.
(As far as why they were placed specifically where they are within these two services, Ms. Farkas' suggestion, cited in @SabbHillel's answer, regarding a juxtaposition to the following Kedushas, sounds intriguing.)