I am fairly new to tinkering with electronics/electronic-adjacent ideas and I have been wondering: how do electronics get the desired voltage/current to operate properly? I understand in AC power, there are step-up and step-down transformers that allow you to raise or lower voltage, but what about the current? The additional voltage can't come out of nowhere due to thermodynamics, so does it convert the current into voltage? And does that work in the opposite way?
So, for instance, say you had a power source of 12 watts (24 volts, 0.5 amps) and you had a device that needs 2 amps. Would a transformer essentially convert the (24 volts, 0.5 amps) to (6 volts, 2 amps)?
Alternatively, if you had a power source of 12 watts (6 volts, 2 amps) and a device that needs (24 volts, 0.5 amps), would a transformer essentially convert the (6 volts, 2 amps) to (24 volts, 0.5 amps)?
I understand conversions would have losses, but these are just hypothetical examples.
If I am mistaking how transformers work, what electrical components and/or circuits can accomplish the functionality stated above?