This is a touch sensor. The touch sensor is a sensor that detects contact with objects in the robot's environment. The touch sensor reports to the RCX Brick if its button is pressed or not pressed.
It is important to connect the cable to the touch sensor in the correct way. The images on the right show the right and wrong way to connect the cable to the touch sensor.
How do I program a Touch Sensor?