It was (originally) for localization: ja.reddit.com would (for example) give you a Japanese interface. Eventually they realized what a horrible idea l10n is for a community-oriented site, and dropped the translations, but kept the `lang` that it would apply attributes. Eventually subreddit moderators figured out that you could use this to provide multiple variants of the per-subreddit CSS, such as dark modes, custom filters, and other silliness[0].
[0]: For example, see /r/CrappyDesign with (https://old.reddit.com/r/CrappyDesign/) and without (https://of.reddit.com/r/CrappyDesign) Comic Sans.