I press Ctrl+S keys to save in the middle of the work, but sometimes the grid origin changes when I accidentally press the S key.
If you work without knowing that the grid origin has changed, all coordinates will be misaligned afterwards.
Why are grid origin and drill origin separate?
And I would like to express my opinion that it would be better if the shortcut S key to change the grid origin was changed.
The shortcut key S may be changed in Preferences / Preferences / Hotkeys. It is listed in the “common” section.
Perhaps use “Alt + S” instead of “S” to avoid your problem or swap “S” and “Ctrl + S”.
It’s better to just search for grid in Preferences / Preferences / Hotkeys. This gives an easy overview of all grid related hotkeys. KiCad has hundredths of them, and quite a lot do not have any key assignment by default. Every now and then a complaint about then n hotkey to change the grid size also pops up. Hotkeys are easy to change (Just double click on a line) or disabled (Right click for the sub menu popup).