Somalia has become a pirates’ nest because there is no strong central government and virtually no legal system or industry in Somalia. The country has been ravaged by war, famine and terrorism. So of course there is extremely high unemployment, poverty, and fear. Life expectancy for Somalians is only 55 years and barely a third of the citizens can read.
In addition the shipping route that connect the Red Sea and the Indian Ocean is very near to Somalia's coastal waters. Since there is no strong central government, the coastline is not protected or patrolled and piracy is a great temptation to make money.