I want to install something different than wordpress under 'mydomain.com/login', but WordPress automatically redirecting this link '/login' to '/wp-login.php'.
Where can I turn off this redirection?
If you look at
This answer is based on the findings of “login” in permalink redirects to wp-login.php wp3.6
Disable "/login" redirect
As already stated there the relevant code is located at the very end in /wp-includes/canonical.php
You need to remove the default "wp_redirect_admin_locations" and replace it with a slightly modified custom version. Add this to your function.php file.
Why this might not even be necessary
Also you should be aware that the redirect only applies if there is nothing else at /login. As soon as e.g. you create a page /login the redirect doesn't apply any more. (See /wp-includes/canonical.php:553 for where this happens.