Which sentence is more correct?
- How can I categorize the user's answers into predefined categories?
- How can I categorize the answers of a user into predefined categories?

Is there a better way to formulate the question?
Both of the sentences are grammatically correct and convey the same meaning. The difference is only in the placement of user's and a user.

Another way to formulate the question could be:

What is the best way to categorize answers into predefined categories given by users?

This phrasing removes the possessive form and specifies the context in which the answers are given (by users). It also emphasizes the importance of finding the most effective approach to categorization.
Your proposed sentence has changed the meaning of my sentence. My sentence was about the answers given by a user, while in the sentence you propose, the part “given by users” seems to apply to the categories. Can you suggest a reformulation that preserves the meaning of the original sentence?