Reviewer changed their mind after positive earlier feedback
The last time this happened to me, it was because one of the two original reviewers was unable to review the revision, but journal policy mandated two accept recommendations before acceptance. So the editor invited a third reviewer, who recommended rejection. I do think it's pretty unfair to the authors when this happens. After all, if the paper is not suitable for the journal, the journal ought to desk reject immediately and save everyone's time.
I suggest writing to the editor and asking them if they're sure of their decision. After all, they did say minor revisions in the first decision. If they say they're sure there's nothing you can do but submit elsewhere, but there's a chance they'll agree they have been unfair.