"I didn't like that book."
Translation:No me gustó ese libro.
Does the 'me' refer to 'I' in the beginning of the sentence? And the conjugation of gustar refers to the book?
Gustar work like the English verb "pleases". So "that book pleases me" in this case. That's not the best translation, but it helps make sense of why it's "me" not "yo" and why gustar is in the third person.
The Spanish sentence "Me gustó ese libro" has "gustó" (it pleased) as the subject and verb, "me" as the indirect object pronoun that translates to "me" in English, and the noun phrase "ese libro" (that book) as the direct object noun. Literally, this translates to "To me, that book, it is pleasing." If you substitute the correct syntax/word order in English, the word-for-word interpretation is "That book didn't please me."