By RAW Freedom of Movement does, Freedom doesn't. Freedom of Movement ignores anything that would impede your normal movement, this includes encumbrance and difficult terrain. Freedom is very specific in what it frees you from however, not to mention Freedom is an instantaneous spell so it only helps you in the immediate. So even in the case of something like web, if you were freed and then immediately failed reflex again and got stuck, you'd have to cast Freedom again. Freedom of movement just wouldn't let you get stuck by anything as long as it's working.
Although you bringing it up in that case you could rule it that the squares of difficult terrain you're currently in turn into normal terrain, and that all your gear falls off. However that wouldn't be RAW, it'd just be funny.
Freedom of Movement explicitly disallows the application of two conditions to the subject of the spell, namely they can't be paralyzed nor restrained.
Stunned is also a condition. It is not listed under FoM as disallowed. Stunned also does not reduce the target's speed. It states that the target can't move, whereas other conditions, as you noted yourself, explicitly state an altered speed value.
The paralyzed condition is almost the same as the stunned condition, the only differences being that 1. a paralyzed creature can't even speak falteringly, 2. attacks targeting a paralyzed creature and coming from an attacker within 5 feet of the paralyzed creature are critical hits. Paralyzed inflicts another condition, incapacitated on the target. So does stunned. Stunned does not inflict paralyzed on the target. FoM explicitly disallows paralyzed, but it does not mention stunned, ergo FoM does not protect against stunned, nor against spells that apply stunned, such as Power Word Stun. Considering there's no Power Word Paralyze and no Power Word Restrain, this seems to be a conscious design choice.
I'm not sure I like this, but this is how I read RAW: FoM does not allow movement when its target is stunned regardless what applied said condition to its target (and no matter that stunned is a weaker version of paralyzed.)
-
RAI I think the reasoning behind this is that stunned affects your mind, not your speed. Your speed is the distance the creature can cover. When stunned, its speed is the same, only the will to cover the distance unaffected speed would allow it to cover is impacted. (Also, the word "move" in the definition of stunned covers not just the movement of the legs or similar which allows the creature to go some distance. A stunned creature doesn't gesticulate, etc either. At least in my interpretation.)
(PHB 5e 1st printing, 2014, no errata, pages 244, 291-292)
Best Answer
No, it cannot help you escape once swallowed
The relevant parts of the Freedom of Movement spell are quoted below (PHB pg 244):
Being swallowed is neither a spell nor magical effect so this paragraph doesn't help us.
Grappled is not Restrained, so this would not get the PC out of being swallowed. If your DM took a more generous reading of that line quoted above, then they could interpret "nonmagical restraints" to include anything that gives you the Restrained condition, but that's not how I read it.
Assuming you had the spell cast on you before you were swallowed, you could get out of the initial grapple that allowed the Kraken to swallow you, since it can only swallow a creature that it has previously grappled. From MM pg 197: