Ice, rest, NSAIDs. Most swollen, painful joints are due to overuse, arthritis, bursitis, tendonitis, etc. These can usually be treated with rest, ice, and anti-inflammatory medicines like Motrin or aleve (naproxen). Sometimes drainage and injections can also help. If the joint swells rapidly or is red, hot, or extremely tender, see your doctor as this could be something more serious like an infection or gout.
What caused it? There are many things you can do. But first you may want to know what caused it as there are many causes for swelling and pain in the knee, such as injury-related meniscus tears, ligament tears, blood collection, or infection, arthritis, crystal-induced (gout, etc), and other inflammatory causes. Start with ice, anti-inflammatory or pain meds, and leg elevation while waiting to see a doc.
Consider. Consider seeking evaluation by an osteopathic physician. Dos have additional training in the musculoskeletal system. Use of these skills can help to assess and manage your knee pain. I agree, etiology is important. Also rest, ice, compression, and elevation until seen. Injections can be therapeutic and diagnostic if appropriate. Nsaids with HTN and gerd caution. Consider imaging and referral.