With $UserBaseDirectory/Kernel/init.m the most obvious place to put code which should be autoloaded has been mentioned.
But I think it might be worth mentioning that there is also the Autoload directory within $UserBaseDirectory where you can put any package file or package directory and those will automatically be loaded at startup. For the purpose mentioned I think that might be an even better place (after having the code set up as a proper package of course...).
I have not checked when the Autoload packages are loaded, but I know that init.m is loaded at a quite early stage, where I think some functionality that needs Java or the PacletManager might not yet be available. So that might also make a difference, depending on what the code actually does...