Gyro Sensor Problem and Workaround
The built-in gyro sensor in the LEGO MINDSTORMS Robot Inventor hub allows a program to sense the angular direction and motion of the hub (in all three axes: roll, pitch, and yaw). This can be used to make a robot sense changes in its tilt or turn angle, for example.
However, for the gyro sensor to work properly, it needs to complete an internal calibration each time you power up the hub, and this calibration requires that the hub be completely motionless for a few seconds. Until the calibration has a chance to complete, the gyro sensor will just report 0 angle no matter what direction it is facing.
So, if you are having trouble getting a program that uses the gyro sensor to work, especially if it doesn't seem to respond at all, or if the model behaves erratically and totally different from the intended design, set the model down on a table or floor and let go, so that the hub is totally motionless for a few seconds. This should allow the gyro to complete its calibration and start working.