The prayer we know as Ashrei contains primarily Psalm 145 which is written using the Aleph-Bet acrostic (missing the letter Nun). Psalm 145 starts with the words "Psalm to David". IIRC, Talmud Brachot 4b calls this just "Tehilla L'David", which seems to indicate that the term Ashrei was not known or used in the Talmud, and this must have been a much later addition.
Two verses were added before Psalm 145, both beginning with the word Ashrei - one from Psalm 84 and another from Psalm 144.
Why were these verses added? In your answer, you can include history, but I am mainly interested in the reasoning for these additions. If there are other versions (additions) that appeared at some point, you are welcome to mention these.