There is no obvious errors found in your code.
Please contact your local FAE to send those BNO055 back for failure analyze. Then we can understand what's wrong inside sensor.
After understand the root cause, we can judge if it is caused by strong magnetic surround.
In general, the strong magnetic close to sensor shall not cause this kind of issue since sensor is still in working range and can output correctly.
I will more doubt like ESD issue on the board.