In the TV show Supernatural, Season 6, Episode 15, Sam and Dean find themselves pushed into an "alternate reality" where they are two actors acting in a TV show called Supernatural. And their names (in the alternate reality) are Jared Padalecki (Sam) and Jensen Ackles (Dean).
In real world, those two are the two main actors in Supernatural (in our time, our world). Its the same case with Misha Collins (Castiel) and Robert Singer (Producer and Bobby Singer). Also in this reality, Genevieve Padalecki is Sam's wife (this is also true in real life- Jared Padalecki is married to Genevieve Padalecki).
Is there any specific name for this kind of technique? The real actors acting as themselves in the perspective of their characters?
If there is, are there any specific reasons and work that go into this?