What happens if a creature uses Swallow to non-lethally attack a creature (make them unconscious). Would they just stay unconscious in its belly?
It depends on the creature - but almost universally, the swallowed target will keep taking damage and die
Following the general rules about combat, we know that if a creature reduces another creature to 0 hit points by way of a melee attack - such as a bite - they can choose to knock it out and leave it stable rather than strike it lethally so that it is dying. If a monster that makes a bite attack as part of its swallow ability drops the creature to 0hp, it can indeed choose to bite non-lethally, somehow.
The problem with this approach is that creatures with the swallow ability almost universally continue dealing automatic damage to the creatures they have swallowed and have no ability not to do that. Take the Remorhaz, for instance:
While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the remorhaz, and it takes 21 (6d6) acid damage at the start of each of the remorhaz's turns.
There is no allowance for the remorhaz choosing not to do this damage to the unfortunate creature. It cannot turn off its own stomach. Even if it nonlethally bit the target while swallowing, the automatic damage it deals at the start of its next turn will make the target start dying:
A stable creature doesn't make death saving throws, even though it has 0 hit points, but it does remain unconscious. The creature stops being stable, and must start making death saving throws again, if it takes any damage.
So, if the monster doing the swallowing continues dealing automatic damage to the target - and as far as I can tell by a quick skim through swallowing monsters on D&D Beyond, they always do - the swallowed target is still going to be dead in three rounds or less (the automatic damage will cause automatic failed death saves as usual).
A notable exception is the Banderhobb, from Volo's Guide to Monsters. This monster's swallow has the property that a swallowed target:
... takes 10 (3d6) necrotic damage at the start of each of the banderhobb’s turns. A creature reduced to 0 hit points in this way stops taking the necrotic damage and becomes stable.
In this case, this is a deliberate property of the monster - it is created by evil magic and designed to be able to serve as a kidnapper, so it is specially engineered such that it does not kill the creatures it swallows. If the target is swallowed by a monster with a property like the banderhobb, or by some other swallowing creature which does not do automatic damage to a swallowed target, it could be kept unconscious in the monster's belly.
There are a couple of edge cases to consider, though. If the swallowed target has immunity to the damage type in question, then they do not actually suffer any damage while swallowed and so could remain stable and unconscious despite the situation. Also, as PixelMaster points out, a target wearing a periapt of wound closure automatically stabilises if they are dying at the start of their turn (which resets the death save counters), so they would never actually be killed unless the automatic damage is high enough to cause instant death!