Playing around with a cloth simulation, I managed to get that far:

Adding subdivisions before the cloth simulation will increase the foldiness, though that also depends on cloth resistances:

I started with the default cube, resized it on $z$ axis, ✲ CtrlR added loopcuts to make it roughly square-quads based again, but then decided to add much more loopcuts in the bending area:

Probably many of those sparse loopcuts away from bending can be removed, and the dense loopcuts shifted up, as I wrongly predicted where I'll bend…
The bending animation is done using this modifier stack:

- bevel to add holding loops for Subdivision Surface
- Subdivision Surface to give it the final base profile and geometry density
- Simple Deform to bend by 90°
- The magic of cloth sim
- Smooth the bends so faces don't overlap on themselves
- Another Subdivision Surface to further smooth the output by adding vertices
Proper Weight Painting is crucial, and so by improving it you will get better results than me:

Cloth settings are extremely important as well, but I left most settings to defaults and just pinned the weights from above and added just a touch of pressure from inside to direct the bends outside:

