Perhaps you're forgetting that although the NSA have at times historically been regarded as good guys, they've since been found to quietly backdoor crypto products (etc) to others detriment.
Tor was initially funded by the Naval Research Lab (which is broadly similar to DARPA), and from a quick google, has received funding grants from the NSF and Department of State.
That's a bit different from DARPA.