Sometimes the apps have too much cache and need to be purged. That's why Instagram logged you out automatically to clear out the cache or recent temporary residual files. The app will optimize itself to give the best possible outcome to the users.
Solution - Simply, sign in with the correct login credentials to open your account again.
If Instagram logged you out, try restarting the app, check your internet connection, and reset your password if needed. If issues persist, visit Instagram Help Center for account recovery.