I've always been curious about this. It is mentioned that fusion using the Potara earings will keep you fused forever. So why did Vegito split inside Buu's body? I remember Goku and Vegeta saying they were glad they split, but I don't recall them explaining how it happened.
The reason behind the splitting back was never explained in the anime.
In episode 273, The Innards Of Buu, after Goku and Vegeta splits back into their former selves, Goku asks:
"Why'd we separate once we let the barrier down?"
To which, Vegeta has no idea about.
In the original manga, however, Goku tells that it must have been the "bad air" inside Buu.
This was confirmed in the Daizenshuu.
Daizenshuu 4, pg 163, entry for Potara Earrings:
Special Characteristics: To use them, the two people who will merge simply each take one of the two earrings and put in on their left or right ear, respectively. Furthermore, after merging the power is greater than with Fusion. However, the two people will automatically merge as soon as the earrings are put on, and in principle will be unable to ever split up again, so caution is needed when handling them. The merged person will only split up when touched by the air inside Majin Buu’s body. Also, while with Fusion the post-merged clothing is the native dress of the people of Planet Metamor, when merging with the Potara not only are the two people’s bodies mixed together, but their clothing is as well. In addition, pathetically enough the East Kaioshin and his attendant Kibito merged together without knowing a thing about Potara fusion.
According to Episode 66 of Dragon Ball Super, the official explanation as to why the splitting occured, is given by Gowasu:
Goku asks Gowasu how come he and Vegeta split before when he was told the effects of Potara are permanent, and Gowasu explains that those who fuse that are not Supreme Kai will only stay fused for one hour.
The reason they split was never explained in the original "dragon ball z" but it was explained in the new series "dragon ball super" where it is explained that the fusion is forever only if one of the two people fusing are a ki.
The none BS answer is that goku and vegeta are the main characters of the show and the company quickly realized they f'ed up by making the transformation permanent so they had to find a way to fix their mistake so they pulled the first idea they had to separate them out their asses and just went with it.