This is a bit like asking why the fundamental physical constants (gravitational constant, fine-structure etc.) have the values we measure.
No physicist can really answer this.
One approach is varieties of the antropic principle : if they didn't have those values (or similar ones) , then human life wouldn't be possible, therefore we couldn't ask the question as to why they have those values.
An interesting variation to this has been proposed by Lee Smolin : he suggests that there might be an "evolution of universes", which in summary has it that (through somewhat complicated but not-too implausible means) such universes are preferred which happen to allow life to develop.
Now, in HHGTTG canon (right in the beginning of The Restaurant At The End Of The Universe ), there is a somewhat similar idea: There is a theory which states that if ever anyone discovers exactly what the universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.
Later this is picked up, concluding that it means the Ultimate Question and Ultimate Answer simply can't be known at the same time in the same universe.
And we might also read it thus that The pair of Question+Answer must be nonsensical / incompatible / wrongly calculated, in order to prevent removal of the discussed universe.
Any universes in which 42 might not have been the answer would have been destroyed already in favour of ones where it is.
There is another theory which states that this has already happened.
Now, obviously the Odyssey of Arthur Dent's depends a lot on the bizarreness of that universe.
More fundamentally, one might say the very existance of life needs certainly complexity.
At any rate, we can say that Douglas Adams wouldn't have written about a less bizarre universe, implying that he would have chosen the one in which, by the aforementioned mechanisms, the Answer would need to be 42.
scifi.stackexchange.com/users/2981/leftaroundabout
I think everyone is answering the wrong question, perhaps.
Maybe the question should be "what was Adams getting at when he indicated that the answer to Life, the Universe and Everything" was 42?
Adams was an atheist.
If there's no God, metaphysics is meaningless, and mere omphaloskepsis (look it up).
All of your deep longing for meaning and purpose in the universe is nothing more than an evolved response, and the joke's all on you for thinking that there's anything more.
Saying that 42 is the answer is to indicate not merely that there is no answer, but that you're an ass for having asked in the first place.
I think that's what Adams was really getting at, especially in light of the rest of the work.
His answer is neatly fractal - there's nothing more elevated in the universe than the pettiness and meanness of humanity, seen reflected in his alien characters.
I will always treasure HHGTG, but as an adult I can see it for the deeply fatalistic and ultimately hopeless work it is.
scifi.stackexchange.com/users/1150/Chris B. Behrens
I don't believe there's a definite answer to this in canon, but I think we can at least infer the question to which it is an answer to.
In the books, at the end of "Life, The Universe and Everything", they try to extract the question from Arthur's subconscious using tiles from a Scrabble set which he has constructed.
They pull out the following question: "What do you get if you multiply six by nine?"
Now Arthur is known to be a descendent, not of the original Earth creatures designed to be part of the living computer designed to calculate the question, but rather of the Golgafrinchian Arc Fleet B which crash landed on the planet.
As such it is posited that his brain may contain a corruption of the question, rather than the question itself.
6x9 is, of course, 54, not 42.
So it is likely that the best in universe explanation we have for why the ultimate answer is 42 is probably "because the ultimate question is 'what do you get if you multiply six by seven?'
"
Of course, we're still left with a dilemma as to what sense, if any the question and answer are "ultimate", and why that is the ultimate question as opposed to any of the other suggestions.
Perhaps the very point is that the question and answer are both meaningless.
scifi.stackexchange.com/users/1459/Christi
This is one of those questions, that if you have to ask you can't understand the answer.
To expand; in the recorded history of the question only a single being ( a human from the planet earth ) has ever truly understood the meaning, the understanding was immediately followed by the destruction of the planet Earth.
This gets rather complex in that understanding has not yet occurred in our timeline.
This is self-evident as our planet has not yet been destroyed, and we are still asking the question.
We do have enough knowledge to define when the answer will be available/understandable.
One need just skip over to the planning office and see when the hyperspace bypass is scheduled to begin construction in our area.
scifi.stackexchange.com/users/13442/James Jenkins
One of the important things to remember is that in-universe, it is impossible to know why 42 is The Answer .
Prak (who had received a massive overdose of truth serum, and as such was stuck speaking Absolute Truths for a great period of time) explains in Life, the Universe and Everything that it is impossible for The Question and The Answer to be known in any one universe.
This is because this would trigger the aforementioned idea that if anyone truly understood the meaning of the Universe, it would vanish.
So while 42 is indisputably The Answer To Life The Universe and Everything, we will never understand why - the fates will always conspire to prevent the discovery of The Question.
Whether that takes the form of a conspiracy of psychiatrists who have the Earth destroyed moments before its massive program was to complete, or any number of other stumbling blocks, the universe will attempt to prevent its own destruction by preventing the completion of the question/answer set.
Presumably there are other parallel universe whose people know The Question (or at least the correct Question) for that universe) and are eternally trying to discern The Answer.
scifi.stackexchange.com/users/64282/VBartilucci
According to  The Hitchhiker's Guide to the Galaxy , 42 is the  Answer to The Ultimate Question of Life, the Universe, and Everything .   Is it ever explained, in canon 1 , why the answer to the meaning of life is 42?  1 - Book, Film, TV series or Radio series.
Why is '42' the meaning of life?
scifi.stackexchange.com
<the-hitchhikers-guide-to-the-galaxy>
scifi.stackexchange.com/questions/45064
scifi.stackexchange.com/users/19692/cynthia l
No physicist can really answer this. Presumably there are other parallel universe whose people know The Question and are eternally trying to discern The Answer. In  Life, the Universe and Everything, Prak  that it is impossible for The Question and The Answer to be known in any one universe. Perhaps the very point is that the question and answer are both meaningless. This question will remain unanswered since the answer is impossible to obtain and cannot even be explained by a physicist.
This question will remain unanswered since the answer is impossible to obtain and cannot even be explained by a physicist.