The code does not become energy. The code instructs the Arduino how to behave, just as written instructions given to a person would. Except the Arduino is much less intelligent than (some) people.
Inside the main Arduino chip are lots of transistors that switch on and off according to these instructions. A transistor is a solid-state (i.e. no moving parts) component that will allow power to flow - or not allow it - depending on the state of its input. So, when you write code, you are essentially giving these transistors instructions.
If you don't understand what transistors are, it's probably best to think of them as a controllable valve, such as may control the flow of water.
Some of these transistors are connected to the output pins of the Arduino. When they are instructed to let power flow, power is allowed to reach the output pins and will power anything connected there.
As mentioned in comments above, the amount of power capable of reaching the output pins is very small. You can use it to power low-current devices like LEDs (with a suitable resistor!), but if you draw too much power you will kill the Arduino.
To power high-current devices, you would use a transistor of your own.