Usually X+然 has some kind of meaning related to X, especially archaic usage. However I do not see any relationship between 居 "to reside" and "unexpectedly". Are there any historical sources that explain where this expression came from?
out of my expection. I have never thought.
There is a famous 对联
There are customers visiting the Natural House, Unexpectedly, They come from the Heaven.
You can find some early attestations of 居然 here: https://ctext.org/dictionary.pl?if=gb&char=%E5%B1%85%E7%84%B6
居 means squat/occupy/dwell.
In Classical Chinese, 然 is a contraction of 如是 = "as such," which subsequently became productive as an adjective and adverb generator. You can mostly figure out the result by accounting for the grammatical context of the main verb.
Some not super obvious ones, including 居然:
- 突然 = jump out as such = jumpy, jumpily = suddenly
- 当然 = fit/match as such = fittingly
- 依然 = lean on as such = dependable, dependably = still
- 固然 = firm as such = certainly, undoubtedly
- 自然 = originate as such = originally, naturally
- 竟然 = culminate as such = finally, really, actually
- 居然 = keep low as such = quietly, unexpectedly
Just a guess: the character 居 originally is made up "From person squatting 尸 and upside down baby 古. Meaning the place you were born, dwelling." according to http://www.chineseetymology.org
Maybe, the original meaning of 居然 was 'an unexpected pregnancy or birth'
There is an old character 毓 yù: give birth to; bring up, educate. In Cantonese this is apparently pronounced juk1.
Attached are 2 images, one from zdic.net and one from chineseetymology.org
One is an old version of 毓, the other is an old version of 居
All supposition of course!