It may be caused by Blocked Puncta. It allows tears to drain the eye into the nose. There is a small hole on the top and bottom eye lid, in the corner. It can get clogged, infected, blocked. This can cause swelling and pain in the corner of the eye like everyone has mentioned.
You may get stye which is a kind of bacterial infection. As the oil gland at the base of the eye was blocked, then your eye began to swell. Don't worry about it. Just leave it for a week or so. It will disappear on its own very soon.