The 'a' causes an aspirate mutation. https://www.bbc.co.uk/bitesize/guides/zsv8wmn/revision/3
chi means "you" (when speaking politely and/or to more than one person).
i in that context means "I".
The 'n in both cases is a contracted form of the particle yn, which doesn't get translated.
- dw i'n hoffi coffi "I like coffee"
- rwyt ti'n hoffi coffi "you [one person] like coffee"
- mae e'n hoffi coffi "he likes coffee"
- mae hi'n hoffi coffi "she likes coffee"
- dyn ni'n hoffi coffi "we like coffee"
- dych chi'n hoffi coffi "you [polite/several people] like coffee"
- maen nhw'n hoffi coffi "they like coffee"
So you not only need the right subject pronoun (e.g. i for "I", chi for "you") but also the correct verb form (e.g. dw i but dych chi).
Is "i'n" a contraction of something?
Yes: it's a contraction of i and yn.
i here is the subject pronoun "I".
(There's also at least one other word spelled i.)
yn here is a grammatical particle that you can't translate to English -- its purpose is to link a form of bod (to be) to a predicate (a verb, a noun, or an adjective).
(There are also at least two other words spelled yn.)
As for the "can't translate" -- a very rough comparison (not by meaning, just by "this is a grammatical word") is with the helping verb "do" in English sentences such as "What do you see?". The word "do" doesn't mean anything on its own here -- it's just a word that's required by the grammar in questions and negative sentences.
Or the word "to" in a sentence such as "I want to buy a new book".
It's a bit of a dangerous game to try to create 1:1 correlations between your learning language and your target language, since both have their own quirks.
Unfortunately, when starting to learn Welsh, I found that the short answer is often brute-force "because it just is" and the long answer is "A Dissertation on Proto-Celtic, pt II of XVII."
Welsh can conjugate the verb stems according to person and arrange the sentence more similarly to SVO word order (which is what English generally uses). This occurs in more literary and formal registers, but all the irregular conjugations are a hassle in spoken Welsh, especially for learners.
So, spoken Welsh often just uses "[be-verb] [subject] yn [verbnoun] [predicate ...]
If you're trying to put English words in spoken-Welsh order, it's more like "be the exam yn difficult" (mae'r arholiad yn anodd).
Simple "tenses" are generally expressed by using mynd (literally "going") plus another verbnoun for the future, or replacing yn with the preposition wedi (literally "after") for the past.
So your second sentence becomes "be he after eating cake" (mae o wedi bwyta cacen).