In C files are compiled into one huge file, if this is the case then how does static work?

You are indeed overthinking it.

When compiling and linking a C application, only a very small number of the names you used in your source code can actually be found in the executable file that gets created (probably a few more if you are building in debug mode). And all of those are slightly to significantly different from what you typed in your source code (most of them will have at least an _ added in front of them).

When compiling your source file into an object file (to get from source code to a format the linker can understand), the compiler throws out as many names as it can. And it it encounters a name that cannot be thrown out for some reason and must also not be confused by the linker with similar names from other files (for example, because the name refers to a variable or function declared with static), the compiler will transform the name in such a way that it becomes unique.