Drill two holes in each leg of the swing set, as close to the bottom as you feel is prudent. The holes should be drilled crossways from each other (forming an X), and one hole should be slightly higher than the other so that you can push a bolt through it without interfering with the other.
Slide a 10- to 12-inch galvanized bolt through each hole you have drilled. You want the ends of the bolts to stick out from each side of the leg and make an X pattern. You will need two bolts for each leg (so a four-legged swing set will require eight bolts).
Secure the bolts to the legs with nuts and washers so that they do not wiggle and remain firmly in place.
Dig holes in the ground with a shovel where each leg of the swing set will go. The exact depth of the holes will vary. You want to go beneath any sand or wood chips to solid ground, and beneath the frost line in winter if you live in a cold area. Anywhere from 1 to 2 feet should suffice.
Fit the swing set into the holes, making sure that it remains level and doesn't tilt. You can do this by measuring the swing set with a level and raising or lowering legs by placing dirt or small rocks under them.
Fill the remainder of the hole with rocks and dirt once you have set it level. The heavier the rocks, the better: you want them to help anchor the swing set by placing weight on the galvanized bolts.
Pat the soil around the legs firmly and tie each leg down, if necessary.