Apartheid South Africa's government focused on providing electricity mostly for the white minority, which it did well, but the majority of South African, especially in the rural regions, lived with no or unreliable power supply. Post 1994, with removal of sanctions, the economy opened up. There was a lot of international investment in South Africa. The economy grew strongly and the demand for electricity significantly increased.
The supply side was woefully mismanaged and didn't nearly keep up with the pace of the growth in demand. Corruption is definitely a key reason, as others here mention, with the effect being that power plants are not adequatly maintained and new planned power plants going far over budget and missing deadlines [1].
Besides corruption, there are some policitical constraints. Eskom provides power to municipalities who often don't pay. Soweto, with 1.3 million residents owe Eskom in excess of $1 billion [2]. The South African Supreme Court of Appeal has ruled that Eskom is not allowed to cut power to non-paying municipalities [3]. In contrast to a free-market system, Eskom price hikes are subject to regulatory approval [4].
One could debate the relative significance of each of these factors, but it's by no means due to only a single one of these.
[1] https://www.news24.com/fin24/Budget/how-medupi-and-kusile-ar...
[2] https://mg.co.za/article/2019-10-18-00-why-we-dont-pay-for-p...
[3] https://www.iol.co.za/pretoria-news/news/eskom-cannot-cut-el...
[4] https://www.moneyweb.co.za/news/companies-and-deals/electric...