I am writing a rather dark, grey fantasy story. It is supposed to feature a twist that turns the antagonist's goal to not to be evil at all (just misjudged) and really trivial (despite requiring large dose of effort). The protagonist changes for the worse, but I still get the feeling that that kind of twist will undermine the whole dark-ish feeling and readers' expectations. Would it work? Should I rework that idea?
I would like to offer a frame challenge: you're asking "will X make my story not fit the 'dark fantasy' sub-sub-genre". I say, write your story, make it a good one, then think what genre or sub-genre it fits.
Does the twist you're planning make your story a good story? Neil Gaiman says "Fiction is the lie that tells a truth" (source). Are you telling a Truth? Then go for it. If in the end your story comes out not "grimdark fantasy" but just "fantasy", where's the harm in that?
For what it's worth, I find that a world that goes all wrong because of somebody's trivial wants, and somebody making stupid mistakes, and somebody burying their head in the sand, and somebody clucking their tongue but being unable to be bothered to do something - that's both more realistic and more tragic than some evil mastermind deliberately working to destroy things. But that's not the main point.
I think it is a mistake to write half a book as a grim fantasy, then have a twist that undoes that. To me, I am disappointed if the author builds up a dire scenario that suddenly fizzles out, the hero wanders off, the villain turns out to be working an elaborate insane scheme to corner the Nutella market, or write "Bite Me!" on the Moon.
The Reader's expectations are set in the first 25% of the book, both directly by the author and implied by the tone and events, and the whole book should be consistent with the first Act. In the first half of the first Act, reader's will accept just about anything; magic, ghosts, intergalactic civilizations, immortality, God (or Gods) walking the Earth, whatever.
By the End of the First Act, reader's should know everything important about the world of the MC and Villain.
If you really want the twist to pacify the villain and flip the protagonist, you have to signal the tone of this from the beginning. Don't promise a grim fantasy that fizzles out. That's about as bad as the "It was all a dream" deus ex machina. Make it something else.
Otherwise, continue with the story you promised readers; the hero (compromised or not) will have a confrontation with the villain.
The risk that you run here is that, in making the antagonist's goal trivial, you also trivialise the heroes' quest. 300 pages of blood, sweat, tears, agonizing combat, and heart-wrenching deaths later, your hero finally stops the villain... from introducing strawberry jam alongside the existing raspberry and cherry. Oh, the horror.
However - while your antagonist's goal might be trivial, or even acceptable to the protagonist, either their methods or the potential side-effects might not be. Introduce strawberry jam through a clever marketing campaign and a catchy jingle? Everything is awesome. Introduce it by blowing up other preserve factories? That puts us in a bit of a jam. Accidentally revive the neo-Nazi Strawberry-Supremacists while doing so, and kick off World War IV? Really not cool, man. This works quite well if the "twist" is that the protagonists initially thought that the "unexpected side-effect" was actually the antagonist's main plan all along - while the antagonist may not realise that they are the cause, or even be completely unaware.
The story then shifts from a straight "us-versus-them" narrative to "I agree in principle, but not in execution". Your protagonist and antagonist might start working towards the same goal, but from different angles, each trying to talk the other around to their viewpoint. "Your way is too slow", "your way is too reckless" - they may even team up for a short time, even while trying to sabotage each other. And, of course, it leaves them both open for a revelatory "oh no, what have I done", and a final sprint to reach their objective while also counteracting the negative consequences they have inadvertently spawned.
After all - they may say you can't make an omelette without breaking some eggs, but you can get pretty damn close with soya milk and silken tofu.
There certainly are precedents.
A well-known (in Russia) sci-fi novel has a twist ending where it turns out that an ostensibly evil opponent was actually a high-placed agent in the enemy ranks, his efforts to capture the protagonist were meant to protect him, and the protagonist's actions at thwarting the Evil Plans made things worse.
If a plot works in sci-fi, why not in dark fantasy? Though making the goal trivial instead of as grand as it seemed, but good instead of evil might let the reader down.