She boasts about having been beautiful when she was young.

Literal

She [topic-は] young time [at-に] beautiful was [nominalizer-の] [object-を] is-boasting.

The nominalizer の packages the past fact — 美しかったのを — into the object of 自慢する (to boast). の is slightly more colloquial and emotionally immediate than こと. 自慢している with ~ている marks boasting as an ongoing habit, not a one-off mention. Both の and こと can nominalize a clause here, but the nuance differs: の feels more personal and grounded, while こと leans more abstract and formal — in this kind of intimate critical observation, の is the natural fit.