Hi, Welcome to HealthcareMagic Forum.
You have developed a Neck Muscle sprain
and it would have caused the muscle pull which is the cause for swelling. Kindly don't worry as it should not be a serious condition. You can use any of the over the counter analgesics and apply heat pads regularly. You can use a Neck collar if necessary and get adequate rest. It will subside gradually.
Wish you Good Health, Take Care.