Where are theme codes located for WordPress?

They’re probably referring to the functions file in your theme, functions.php. This file is loaded by WordPress during setup, and gives you an opportunity to do things or register hooks and filters. Note that this file is optional, and not every theme has a functions.php, if that’s the case just create one yourself

Keep in mind the only thing that’s special about this file is where it is located and when it’s loaded, otherwise all the code inside it is exactly the same code as in a plugin.

In a lot of cases you can copy paste the code into a new PHP file, add a comment at the top and put it in the plugins folder and vice versa. It’s the same environment too, there’s no special sandbox for theme code that separates it from plugin code