Open BlueStacks Settings → Advanced → Root Access → Enable. Restart the emulator.

The most interesting aspect of this topic is the ongoing battle between emulator developers and app developers.

Edit C:\ProgramData\BlueStacks_nxt\bluestacks.conf:

bst.feature.rooting=1
bst.feature.gpu.vulkan=1
bst.feature.sensor.enable=1

You are responsible for your actions. Before using any bypass technique, ask:

Never use bypass techniques for:

If you cannot bypass detection: