There's a specific tax that workers (either self-employed or otherwise) pay that goes to social security (as opposed to the general federal income tax), and as far as I know, those specific funds go to the central social security trust fund rather than the federal government's general fund. Funds used for invading other countries, paying off interest payments, etc. etc. comes from other revenue streams.
As I understand it, the reason SS is potentially in trouble is that, the baby boomers are beginning to retire and draw on the system. This represents a simultaneous large decrease in the number of people paying into the fund and increase in the number of people extracting money from the fund. The precise financial implications of this seem to be up for debate- some people say that there will be sufficient money to cover everybody, while others say that there won't be.
I personally don't see how it can possibly work, but I'm certainly not an economist so what do I know? At any rate, I don't expect to see a dime of it when my time comes. At this point, I view the whole thing as basically a charity for baby boomers, and from that perspective it kind of makes sense- unless we want to let them die/starve in the streets, we're going to end up paying for them one way or another; we may as well make use of the existing infrastructure for helping to support elders.