Tor is open-source and its developers and supporters include the EFF, Jacob Appelbaum, and others who (if you can trust anyone at all) would not cooperate with government surveillance. But again, it's open-source and lots of security experts regularly look at the code, so it's not so much a matter of blind trust. The reason it was funded by the US government is described at http://cryptome.org/0003/tor-spy.htm -- not because it helps governments to spy on users but precisely the opposite.
The fact that it's very unlikely it was created as part of some conspiracy doesn't mean that it's impossible to compromise a Tor user's anonymity. I'm not an expert but as far as I know the most credible large-scale attack against it is still the one described in this paper: http://wesscholar.wesleyan.edu/cgi/viewcontent.cgi?article=1... . To be successful, it requires controlling a very large proportion of Tor's entry and exit nodes.