Which would be better to say?
- He reminds me of Dill from To Kill a Mockingbird.
- He reminds me of Dill in To Kill a Mockingbird.
- He reminds me of Dill of To Kill a Mockingbird.
Also, which is more appropriate in a formal context?
Of the three options, ‘of’ is the least common, as bib mentioned. I cannot think of a particular situation where it would be more appropriate than ‘from’ or ‘in’.
‘From’ and ‘in’ have slightly different meanings:
If you were comparing actions, rather than entire characters, ‘in’ would definitely be far more natural than ‘from’—e.g., “He eats a slug and then immediately throws up, reminding me of Ron in Harry Potter”, where the reference is not to Ron Weasley as a complete character, but rather to the specific setting/scenes where he is unfortunate enough to end up vomiting slugs for half a day. ‘From’ here would have been somewhat awkward, indicating that Ron’s entire personality reminds you of someone eating a slug and then throwing up.
If you are simply comparing characters as a whole, however, both work fine, although ‘in’ gives the vague impression that there is something more or less specific in To Kill a Mockingbird that makes the character you’re describing here remind you of Dill.
Assuming you're communicating the equivalent of "He reminds me of To Kill a Mockingbird's Dill." I would assume the answer would stress source-as-in-origin of the character by the book and not the character's source-as-in-locale. Therefore, I would choose to say, "He reminds me of Dill of To Kill a Mockingbird."