Somalia is a fertile training ground for the militants who end up in the Minneapolis area or as pirates. It benefits the US to have them nipped in the bud.
There are two reasons to be in Somalia:
1) Ungoverned spaces in that part of the world are breeding grounds for Jihadists. They take advantage of the chaos to prolong it and train and operate with impunity. We have to deny them places to hide and train, make them react to us.
2) Somalia is adjacent to the worlds busiest shipping lanes critical for North American and European trade with Asia. If we dont help the locals put their house in order, our competitors, namely China, will. They have a new base in Djibouti, just north of Somalia, and are actively working to displace the U.S and European nations and created a monopoly dominating African resource trade.