The answer would generally be the same for why any person would leave their home – A better opportunity.
If you are truly a top-notch software developer and you want a job working closely with other top software developers at a top company then you might want to move. In some cases you will not have the opportunities locally that you can have in areas like Silicon Valley in California (USA).
There might be opportunities to still work for some of these companies remotely and still live in Africa if you want.
In general you will be paid more money, but the cost of living will also be higher.
Some people will leave to gain valuable training and experience and then come back and start their own company.
If you are younger, there is also the draw of major cosmopolitan cities like San Francisco, New York, London etc.
Source: Quora