Most of Africa has been exploited almost solely for raw resources by the Europeans during the last 500 years, and this exploitation is still going on now. Initially, the exploitation was limited to a somewhat mutually beneficial trade, mostly in gold, slaves and ivory.
After the Scramble for Africa (1885-1914), (and in some cases such as South Africa) the Europeans started to exploit the resources more directly. They typically used African workers to work in mines and plantions growing cash crops. The main reason why the Europeans acquiesced to granting independence to the Africans was that the defense of these colonies against other European countries was somewhat too expensive compared to the revenues generated. Thus, they allowed African countries to gain their independence, in order for them to pay for their own army, but they still kept control over the economy.
Another issue is that African governments still needed money to build roads, schools, dams and factories. The only real alternative was loans from Western governments. But the loans came with strings attached: no tarrifs, quotas or other traditional government protective measures were allowed. As a result, African industry was doomed from the start and these loans could not be paid.
This caused many African Governments, including Kenya's, to go bankrupt. This caused corruptionCorruption became rampant, in countries where governments could not pay their bureaucrats adequately. The only alternative was military dictatorship. But the economic root causes were not eliminated, so then the military became corrupt.