"Why this works this way" is a dependent noun clause. "Why does this work this way?" is an interrogative sentence. You're not asking why thing works. You're asking a different question "Do you know" about the fact "why this works". Interrogative sentences are inverted, which explains the word order difference. The noun clause is not inverted, since it's not interrogative.
Change the words up for something simpler, and it will be obvious:
"Do you know why the wood burns"?
"I know what he likes".
The awkwardness you're perceiving in the original has more to do with the repeated "this" than the clause structure.