The Charter of the United Nations specifically names the Republic of China (which now only controls Taiwan) and the Union of Soviet Socialist Republics (which no longer exists) as permanent members of the Security Council.
There’s no mechanism to replace the permanent members, but for the sake of expediency everyone just kinda agreed that the PRC and the Russian Federation are successor states.
Whether successor states can sit on the Council is a moot point, because they do.