“Energy” in the sense of your desire to move around, focus on things, etc, and “energy” in the physics sense, are not the same thing, though they’re weakly related. You’re still consuming physics!energy while you’re sleeping, even though that’s your lowest psychological!energy state, for example.
Caffeine is a stimulant. That means it pushes the body away from restful behaviors and towards energetic ones, and shifts the body into a physical mode that prepares it to take on those energetic tasks (in medical terms, it increases *arousal* – this is a different, more general, usage from its use in sex). For example, it increases heart rate and blood pressure as part of supplying more oxygen to the body.
That means that caffeine gives you more psychological!energy. But running your body that way has trade-offs. One of them is that your body is *consuming* more physics!energy to run itself. In that sense, caffeine actually *costs* you energy, at least a little. (Another trade-off is that your body puts maintenance work on hold to support immediate activity.)
Latest Answers