Laboratory is where you can use the Magic Dust to exchange your current 4-star and 5-star Heroes for other random Heroes of the same level, element and star ranking. Magic Dust can be obtained by using Summoning Spheres at the Elemental Gate.
Just like the Temple of Power, the Laboratory is located in the Hero Academy that can be built after you upgrade your Castle to level 6.
To make an exchange choose a Hero and tap the Exchange button. Chosen Hero would be replaced by a random Hero of the same level, element and star ranking. But please note that if the chosen Hero would have upgrades in the Skill Tree, those upgrades will have to be reset before the exchange.
NOTE! It is not possible to move the upgraded Skill Tree from one Hero to another.