You cannot use a 12V power supply on a 5V. It will cause the device to draw more current than it is designed for and will likely burn out, causing fire hazards and explosions.
In other words, if the applied voltage is more than the maximum rated voltage then the device will undoubtedly fail due to overvoltage. Instead, you can use a commercial IC to convert 12V down to 5V.
Can I Use a 12V Power Supply on a 5V
Your electrical device consists of components that are made to operate on rated voltage and current. If the power supply voltage is higher than the rated voltage of the device, then it is going to draw a lot more current than the device can handle.
As a result, the device components are going to burn out and perish. Although, whether the device will sustain damage also depends on the type of the device. Some will suffer no damage while some will produce smoke and stop working.
The thumb rule is that the device will burn out if the supplied voltage is more than the rated voltage. A simple look at Ohm’s law can help us better understand this.
Supposing that your device has an internal resistance R and the given voltage is 12 volts or 5 volts expressed by V. From Ohm’s law we know that I=V/R. If the power supply provides 12 volts, then the device will draw a lot more current than it would for the rated 5 volts.
As all current limiting values of your device are based on a 5V source, the device will heat up and lead to a fire hazard or explosion. Unless there is a fuse or other circuit interrupter, electrical overstress is likely to destroy your gear.
Long story short, you should avoid using a 12V power supply on a 5V device. Unless there is a protective measure in the device to tackle the resultant surge of current, it is best to avoid using a higher voltage than the maximum rated voltage.