"Legal name" is a catch-all term that usually means "approved for use on government issued ID". Are there instances when that's not always the case and some forms of ID (not just, say, an ID card, but also in tax filings, for example) actually have different rules? Amazingly, sometimes yes. But usually that's what it means.
Legal system as in court of law? They tend to use more letters than I have in my actual passport (definitely more than fits into mrz) and depending on which court we talk about they also use different alphabets. They also assume certain structure in those nsmes, which differs from one court to another.
Yes, I had a pleasure do deal with two courts that use two different alphabets this year. They one of the two referenced the other. The name written in neither of two matches whats actually written in my passport. It isn't a complicated name by any reasonable metric.
Taxes are easier -- they just ids and names are display only kind of stuff, sourced from the base registry.