After a lot of Googling, it seems like there's no industry standard for how games are written. However, most people seem to use a combination of mind-mapping apps and/or actual game engines.
Mind-map software like Miro or yEd can help you visually plan out the structure of the game, can handle a lot of complexity, and are generally easy to pick up and understand, since what you see is what you get. But the actual space for writing can be limited, depending on how large your text sections are.
Therefore, a significant number of people choose to write directly in a game engine.
Twine is probably the most popular, with other visual novel/interactive fiction engines like Inklewriter and Inform close behind. Usually, these engines use a relatively human-readable markup language to create dialogue trees and variables so you can make branching narratives. The learning curve is steeper than with mind-mapping, but ultimately far more powerful. You don't have to use the same engine to write that you're using to develop the game (although you certainly can). If you know what engine you/your team are using to develop, there may also be a dialogue planning tool that ties into it; for example, Yarn Spinner is a writer-focused tool that can send dialogue directly to Unity.
The only tool I found that was focused specifically on narrative design that didn't fall into either of these categories was articy:draft, which is the closest to an all-in-one solution out there. However, it's primarily focused for narrative-heavy adventure games and RPGs, so it's not a universal solution. Katharine Neil talks about its uses and limitations in her 2017 GDC talk (starting at 8:50).
Again, it seems like most people use a combination of these tools, and it depends on your specific situation - you may find mapping helpful, but choose to write most of your dialogue in a traditional script editor and use some referencing system to keep track of which chunks of text go where. Mind maps are generally easier to collaborate on if you're working with a team, and many game engines don't have any native proofing/review system for other team members to leave comments, but if you're working solo those may not be issues.