It comes from the Latin word "compilare", which means "to plunder, to steal, to gather".
In the context of programming, compiling is essentially gathering and organizing different parts of code into a single executable file, which is similar to the original meaning of "pil" in the sense of bringing different elements together.