Stefanik started as a typical mainstream congressperson. Prior to Trump, she was considered to be a moderate to conservative and was willing to cross party lines to get stuff done.
She decided the way to get ahead was to hitch herself to Trump and went all in. She has learned that relationships with Trump are purely transactional and there is no long-term loyalty.
This is purely my opinion...
She knows that Trump has an expiration date and she wants a career after he has exited the stage.
She had no real shot at the NYS Governorship. Especially without Trump's support. But the numbers were clear.
She would have won re-election for her current seat. The NY-21 district leans conservative, but she would be running against a challenger who would likely use her record against her. She would have had to defend that post-Trump. By stepping back now, she can spend a few years out in the political wilderness and move away from the Trump agenda. Then she'll run for the NYS Senate.