Use the 12 volt battery. This is a basic Ohm's law exercise. If you know the amperage at the load, then all you need is a resistor sized in watts to give you the amperage you need and drop the voltage across the resistor to give you 5V across your load. Basically, the resistor will use 7 volts.
If your 5 volt device needs 1 amp, then resistor has to be rated 5 watts. Double it to keep a safety margin and the resistor has to be rated at 10 watts.
Ohms law is I = E/R where I=amps, E=volts, R=resistance
or, R=E/I so if E=7 and I=1, then R=7 or 7=7/1
Just be sure to locate the resistor where heat won't be a problem.