Orkhepaj: why and how and how to prevent this?
There is no way to prevent it, it just happens occasionally and you have to reconnect. The Steam integration is via a 3rd party Galaxy plugin and any problems the plugin has are up to the developer of the plugin to fix. Also, if there are any problems that occur when Galaxy uses the plugin to connect to Steam such as Valve's servers being temporarily unavailable or other similar things there's nothing GOG nor the plugin author can do about that, only Valve can fix their own servers.
What would however be nice, is that when problems with Steam servers do occur, that the plugin continues to try again in a sensible way on its own until it can connect instead of just disconnecting completely and requiring user interaction to fix it. Same is true for all of the other platform related plugins.
I find this problem to be the biggest annoyance with 3rd party platform integration because once you connect all of your accounts, ideally you don't want to have to muck around with any of that again, but instead once every week or so you get disconnected from Steam or Origin or Bethesda or some other platform and it stays disconnected until you go re-login manually again and go through the tedious email verification process for each platform (which is not Galaxy doing it, but the individual gaming platforms themselves). Having to forcibly log in every week or two to random platforms and do the email verification gets really tedious, making the feature less than desired.
I've ended up leaving half of my gaming accounts disconnected because it is too much hassle to have to reconnect them once a week or so when some minor problem occurs that causes them to experience a temporary access issue. GOG wont fix this likely because it is all in 3rd party plugins that GOG didn't create themselves so not their job to fix. Would be nice if GOG would actually take on all of those plugins internally and maintain them and fix them for everyone as a part of the full Galaxy experience but I don't think we'll see that happen.
Hopefully the plugins just continue to get better over time and the problems become a thing of fhe past though.