js file in root loading without

WordPress has no mechanism to load custom js files automatically. If your theme need that js file, then place it inside your theme folder. and link it in your template file. for example,

<script src="https://wordpress.stackexchange.com/questions/353972/<?php echo get_template_directory_uri(); ?>/assets/bootstrap.min.js"></script>

In the above example, “bootstrap.min.js” file is located in my theme’s “assets” folder. the function get_template_directory_uri() return the url to your theme folder. In this way you can link your custom js files to your template file.

… and yet somehow it works.”

As per my experience, this doesn’t mean WordPress loading your js file, as @Kaperto said, WordPress uses a lot of JavaScript libraries by default. Coincidently your expected js file is one of them.