As far as my knowledge goes, 'why' in this case functions as a relative pronoun introducing a clause. I am just unsure whether it is grammatically accurate or at least acceptable to phrase the second clause in a question form (with the do verb coming after the relative pronoun). Which one is actually the correct form? And if one of them were incorrect, could anyone explain to me why?
The second phrasing is correct "I have no idea why I like him so much.".
The reason is that the statement "I like him so much" is the target of the preceding clause "I have no idea why". (Standard) English usage doesn't allow joining statements and questions in this way. In essence, an implied conjunction has been elided from the sentence, which could read as:
I have no idea why[, but] I like him so much.
I have no idea why [it is that] I like him so much.
In practice of course, your (second) phrasing is much more likely than either of those above, which are a bit stilted unless you are looking for a subtle change of emphasis.
English inverts word order (or inserts "expletives" like "do") for questions in a main clause, but it never does so in subordinate clauses.
The reasons offered in linguistics classes are complex (involving a part of speech called "complementizers"). Carnie explains it well, but you need to read the whole book.