Should I Change my Research Focus?
Your advisor's advice is probably worth taking. They know you better than we do.
But your current goal is to get a doctorate. The specific sub field is less important than that goal. You can always take up a different specialty later if it isn't too different.
Find a path to success. Examine the obstacles (exams, ...) and find a way through them. You may have made some judgmental errors, but don't make any more.
But to find that path, in mathematics, find a field in which you have true insight into how things work. Math insight isn't general. You can have deep insight into one field (analysis) and little in another (algebra).