At the top of the world map screen you can see your energy indicator. Energy is spent on entering levels in different locations. The energy cost of playing a level is shown in the bottom left corner of the level selection screen.
The energy is spent the moment you enter a level, so if you fail the level or exit the level without finishing it, the energy will not be restored.
If your energy is less than the cost of entering the level, you will not be able to play it. Your energy level slowly restores by itself by one point every three minutes. However, you can replenish your energy by using certain items, such as coconuts, apples, and meat shanks. These items can be found, received as a reward, or bought from the store. You can use these items from the inventory screen, store screen, or by pressing the “plus” button next to the energy indicator.
Just be aware that you can’t increase your energy above the maximum level. Your maximum energy level depends on your experience level.