How is the /AppleInternal directory hidden from users on macOS? [closed]

It is not really a "hidden" directory or "secretive" in any way.

It is simply that some Apple employees have use a folder with this specific name when testing/using prototype or in-development software on iOS and macOS. The idea is to store testing tools and other files that are not meant to be in the software meant for customers.

The technical concept here is that the contents of that folder is combined with the "ordinary" file system (sort of like an overlay). So if you want to add something to /System/Library/ for testing, but don't want to do it in the "real" software - you could add it to /AppleInternal/System/Library/ instead - and get the same effect.

The folder does not exist unless it is actively created. Therefore the folder is not hidden - it is simply not there on an ordinary installation of macOS.

When you run Xcode, which is meant for developers, it will check if this folder exists - and then for example the iOS simulator will have a few extra options, that are primarily meant for Apple employees. This could be for example features that haven't been tested well enough to be exposed to customers.

The AppleInternal folder has been well-known by non-Apple employees for years - so it is not a new discovery.