Dynamite is a very powerful tool, so you should use it with caution. How you can get it : 
-  complete some quests or tasks
-  buy it from the Trader on the endless islands
-  buy it in the Market on the temporary islands
-  buy it for gems

One Dynamite can help to save up to 200 energy.