Chests mostly come from quests (monsters can occasionally drop them, and they are also sold in the Item Shop). Every area in the game contains a repeatable Treasure quest, offering you an opportunity to acquire powerful items with little effort.
You can add a rune to a chest, improving the chances of getting specific and better items. Some items from these chests bind to you when you open them (if they are faction reputation items).
You can complete all the treasure quests once a day.
Most chests are unlocked and you can freely open them. However, some chests are locked and require an Imbued Key to open. The keys are sold in the Item Shop, though players are sometimes willing to re-sell them for game-gold. Usually players prefer to spend their keys on at least Adamantite Chests.
Some of the chests will be "distorted". Distorted chests have a high chance of cursing the items they contain, if the items are of blue quality or higher. Regular chests do not produce cursed items.