Yes, the detail that this happens mainly during dark or low-action scenes is interesting and could be relevant.
It is unlikely that HBO Max itself is logging you out. A more likely explanation is that macOS is deciding that the system is inactive and is locking the session, possibly because the video playback is not being recognized as active in certain situations.
First, check whether macOS is actually logging out or simply locking the screen. Open System Settings, select Lock Screen, and review the settings for when the display turns off and when a password is required after the screen saver begins or the display is turned off. Also check whether automatic logout after inactivity is enabled under System Settings, Privacy and Security, Advanced. If it is enabled, turn it off.
Apple provides information about these settings here: Change Lock Screen settings on Mac
The fact that Netflix does not cause the same problem suggests that the issue may be related to the HBO Max playback method, browser behaviour, digital rights management, or hardware acceleration.
Streaming services normally prevent the Mac from entering an idle state while a video is playing, but this behavior can vary between browsers and streaming platforms.
If you are using Safari, try testing HBO Max in another browser such as Chrome or Firefox. If you are using another browser, try Safari. You can also test with browser extensions disabled and with a private browsing window to rule out an extension or stored website data issue.
Apple provides Safari troubleshooting guidance here :If Safari on Mac does not work as expected
The connection with dark scenes may occur because a nearly static video frame can interact differently with the browser video layer, display power management, or screen saver behavior. As a test, temporarily disable the screen saver or increase the delay before the display turns off. If the problem disappears, the cause is likely related to macOS idle detection rather than HBO Max account behavior.
Apple documents display sleep and screen saver settings here: Use a screen saver on Mac
It is also worth checking whether the event is a true logout, a screen lock, or a system crash. After the problem occurs, open Console.app and search for terms such as "logout," "loginwindow," "sleep," "screensaver," or "WindowServer." If the logs show that the user session was suspended, the issue is related to macOS power management. If they show a WindowServer crash or system panic, the cause is different.
Apple provides information about using Console here: View log messages in Console on Mac
Because you are using macOS Sonoma 14.8 on a Mac Studio, it would also be useful to confirm that all available Sonoma updates are installed. Apple has included many fixes related to display behaviour, graphics, and system stability in macOS updates.
You can check for updates under System Settings, General, Software Update. Apple provides update information here: Update macOS on Mac
The most useful details for identifying the cause are whether you are watching HBO Max through Safari, another browser, or an application; whether the Mac is connected to a monitor or television; and whether the login screen appears immediately or whether the Mac has restarted.