First, the "letters" question is answered by understanding that Swahili is (now) written using the Latin alphabet, and the sounds that those represent are the morphemes for marking past, future, and so on. Then the question reduces to asking for example "why is the future tense marked with the prefix -ta". That marker derives historically from the verb -tak- meaning "want". It is a common occurrence in languages that future tenses are formed from verbs like want, wish.
The past prefix -li- originates from the verb "be", and represents a contraction of "be" plus main verb in the perfective, similar to English "he has gone". Thus a-li-piga comes from earlier ali apigie "he is + he beaten" (the suffix -ie was replaced with general -a in Standard Swahili but persists in dialects). The origin of -na- as a present / progressive in Bantu is rather unclear: it is ubiquitous, but its meanings are very diverse. The -ku- which appears in negative past forms is also a contraction, probably involving a different form of the copula -ba plus the infinitive, which reconstructs to kʊ- in the proto-Language. There is a point at which you can't say anythnig more than "that's just the way it is", if e.g. you want to know why the copula in the proto-language is -li.