What is this part in my Royal Enfield motorcycle speedometer unit?
It's a unipolar TVS (Transient Voltage Suppression) diode. The package size and markings may be able to lead you to a replacement. It may be a 3.0SMCJ24A
There is a non-zero chance that whatever killed the protective device (generically called a TVS) has killed more devices. If the proprietary microcontroller (MCU) U4 is fried, you're probably going to be out of luck as far as repair goes. If it's just the power supply parts or it was protecting an input line you may be okay.
The battery replacement is probably related in some way. Either because removing the battery allowed the supply voltage to rise very high or because the battery was connected incorrectly for a moment.