Translation:The train is passing by the station.
No, it is not a matter of logic.
If you stand next to me, then you are walking away from me, then it is "mellől".
If you are walking behind me and then pass me because you are walking faster than I am, then it is "mellett".
The same goes with the train. On its way from point A to point B, it "elhalad az állomás mellett". If it was waiting near the station, then started moving again, then it "elhalad az állomás mellől". One is "pass by", the other one is "depart from".
Actually, according the logic of Turkish, you are right, of course. Turkish would use "yanından" - "mellől".
But the logic of Hungarian is a bit different here. According to the Hungarian logic, the place where the passing happens is next to the station. So, Hungarian uses "mellett" in this case.
Actually, English thinks similarly. The train does not pass "from the station" but, rather, "by the station". "Az állomás mellett."