In recent years, the country has been beset by a campaign of violence emanating in part from al-Shabab, a militant Islamic network. Despite this, the country elected a new government led by President Hassan Sheikh Mohamud, which has provided some security, at least in the capital city of Mogadishu.
Plus, there's money to be had. Here's how the Associated Press described China's African interests:
China has a large presence on the African continent, with Chinese companies building roads, airports and other infrastructure. Beijing has opened more embassies and commercial offices in recent years. Last year, China-Africa trade reached $210 billion, according to official figures."
It should be noted that Somalia is believed to have significant oil reserves.
Earlier this month, the United States appointed its first envoy to Somalia in over 20 years. As of yet, the U.S. has no plans to open an embassy in Mogadishu, which the Americans have not revisited since leaving the country just five months after the infamous "Black Hawk Down" incident in 1993.