Suppose a program was written in two distinct languages, let them be language X and language Y, if their compilers generate the same byte code, why I should use language X instead of the language Y?
Programmer productivity is important. If it's easier to get the job done with language X -- which could be for various reasons, like syntax, libraries, tools -- than language Y, that's a net win. If their compilers generate the same byte code, as far as I know, they'll execute in roughly the same amount of time under comparable conditions (same hardware, same load, etc.).
What would make a language better than the other to resolve a problem?
Performance is usually a limiting consideration; if performance matters, you're almost certainly going to look at a compiled language and exclude interpreted languages. After that, it's usually some combination of personal preference and programmer productivity to maximize useful work done before deadlines.
For an example of a productivity versus performance argument, interpreted languages like Python, MATLAB, and Julia typically lead to shorter programs accomplishing a given task; here's one example of an empirical ranking, but there are others, such as in Code Complete. This phenomenon typically has a number of consequences, like:
- it's usually faster to write such a program
- it's usually faster to debug such a program
- it usually means there are large standard libraries available to accomplish common tasks
However, the cost of this expressiveness is usually performance, which you can see in benchmarks, so the typical pure Python program is usually 2-3 orders of magnitude slower than a typical C program; for Julia, it's supposed to be more like a factor of 2ish, which is why it's popular.
Also, you have to know -- and be good at -- these languages to extract performance from them, and for MATLAB and Python, if a pure interpreted language implementation isn't fast enough, you have to start replacing parts with compiled language implementations anyway. Once you start delving into multi-language programs, productivity goes down, and it's harder to debug. Similarly, if you have to learn one of these languages, that takes time, and when you're not a language expert, you program more slowly than if you are a language expert. So there are a number of tradeoffs.