How can one earn Stack Exchange swag? For which sites is it applicable and is there any specific criterion for each site? If applicable what are the things one can get?
You can't, at least not for sure.
In the past, swag has been sent to top users of new beta sites as those sites graduate. If you look through the per-site metas of Travel, The Workplace, and Programmers you will find posts about it (probably a number of other sites too, but those are sites where I remember seeing the posts.) Of course, this does not mean that the same is going to happen for any current beta sites. See How will graduation/election swag work with the changes to the "graduation" process? for a request - as yet unanswered - for precisely that information.
There once was a store, but there isn't now and no plans to revive it have been announced.
Shirts and mugs are sometimes given out as part of celebrations - however these are not pre-announced so you can't work your way towards earning them.