In New York if you take garbage and out in your car that is illegal but if you are on foot and pick it up it is legal to do so. The security guards may be looking at you as a trespasser but if you live at the complex you have a right to be there during your off hours. If the garbage was in a bin/dumpster then it may be illegal to remove it.