I'm a physician. Ok, so it's a very part-time practice; I'm mostly a bureaucrat trying to keep civilization together. Still I have the degree and the board status and I listen to The Curbsiders religiously. So I was really annoyed when my left leg swelled up after a modest knee injury and I didn't know why.
It wasn't just me; neither did my physician wife nor my colleagues nor the veteran ER doc I saw nor my CrossFit Physician colleagues. Nobody had an explanation. My rheumatologist had a story though, and I'll get to that one.
Legs swell for several reasons, but the textbook ones I know of are infection, bad veins, bad lymphatics and a backed up/overloaded drainage system (heart failure, kidney failure - usually both sides same). Less common causes are muscle damage (compression syndrome, rhabdomyolysis) and (rarely) tumors. Inactivity, esp sitting, makes most things worse.
My leg wasn't infected. I didn't think my veins had obstructed but I have a family history of clot  so I did get an ultrasound -- all good. My muscle, heart and kidneys are all reasonable for age. I didn't think my familial  "osteoarthritis" (better called mysterious arthritis) had messed up my lymphatics.
So I was mystified. Why had a knee tweak turned my left (below) leg* into a painless swollen ("edematous") bag with a good half-inch of tough pitting edema over my shin? True, I have an old somewhat arthritic cartilage-depleted knee ill-suited to 150 double-under badly executed rope jumps. True, after the jumps my knee had some kind of meniscal tear and a medial ligament strain. Still, it seemed disproportionate.
I bought a cheap Amazon compression sock that worked better than I expected and I did my usual careful injury care. Meaning I did a lot of mountain and road biking and whatever CrossFit my injured knee could handle. Sitting made the leg swell, sleep and exercise with the compression sock (esp. biking) made it better.
Over the course of about 3-4 weeks the knee improved and the leg swelling mostly resolved. I still didn't know what was going on though. For a while I wondered if I'd ruptured a Baker's cyst (an arthritis thing) doing a heavy squat, but my knee effusion didn't flatten out and the volume seemed too high and persistent.
So I asked my rheumatologist. He claimed I had "reflex sympathetic dystrophy"- see also fpnotebook's great summary. Textbook RSD (now more often called "complex regional pain syndrome") is a badly understood and ill-defined disorder with a dismal prognosis. Patients I've seen with it usually have debilitating chronic pain and often have mental health issues that predate the injury.
I had no pain that I noticed but he claimed this was not unusual in his experience. Reading the online references as a
grumpy old seasoned physician I can confidently say we have no idea why things swell in RSD and that the handwaving talk about autonomic dysfunction and inflammation is mostly bullshit. I do believe there's a genetic component  and that the articles are correct to recommend exercise and compression. Once again my exercise addition led to a good outcome .
So, yeah, I'll go with RSD, which in this case translates as "it swells because you have a (somewhat rare) genetic malfunction in your injury response and the correct treatment is compression and exercise". It didn't show up in the differential of the textbooks I read, but I'll see if my friend Dr. Scott Moses will add it to his fpnotebook article on unilateral edema.
* technically and pedantically the leg is part of the lower limb below the knee but of course we use it to mean lower limb.
 All courtesy of my beloved mother who died age 87 of every possible medical condition (she lived on pure wilfullness). I inherited all her bad genes and, yes, she had bad leg edema. My father by contrast had only a bad back and post-90yo dementia but I inherited his back and probably the dementia disposition too. Happily my children are adopted.
 My back praises the Romanian deadlift.
Update 11/7/2021, wow, that's one ugly looking photo. I don't know what it was, or why it happened, but I guess I'll go with RSD plus some dubious lymphatics. My knee got better over 8-10 weeks and the edema resolved over 4 to 16 weeks. Sometimes I have trace pre-tibial edema but mostly nothing.