Should I use apple or pear in the sentence I love to drink apple / pear juice?
The answer is: it depends entirely on what message you want to convey.
By the way and anyway do not mean the same in that sentence:
It's very unlikely for a planet to hit the Earth. And anyway, why is he so sure about it? He's not an astronomer.
This version could roughly be rewritten as:
It's very unlikely for a planet to hit the Earth. And even if that was not so unlikely, there is another, maybe even more compelling argument: why is he so sure about it? He's not an astronomer.
Whereas the version with by the way would mean something like:
It's very unlikely for a planet to hit the Earth. And oh, yeah, there is another argument as well, let's mention that too: why is he so sure about it? He's not an astronomer.
Although the two expressions are sometimes used to indicate (more or less) the same meaning, I feel that anyway is stronger in introducing a compelling option, one that makes the previous point moot:
You say yes, I say no, but anyway, it's not our decision to make.
The fact that I say yes and you say no doesn't really matter.