At the time when you run a program in python, the interpreter compiles it to bytecode first and after compilation interpreter stores it in the __pycache__ folder. So when you look in there you will find a bunch of files sharing the names of the .py files in your project's folder, you will see that their extensions will be either .pyc or .pyo. These files are bytecode-compiled and optimized bytecode-compiled versions of your program's files, respectively.
__pycache__ makes your program to start a little faster. When your scripts change, they will be recompiled, and if you delete the files or the whole folder and run your program again, they will reappear (unless you specifically suppress that behaviour)
If you are using CPython which is the most common, as it is the reference implementation, so you don't want that folder, then you can suppress it by starting the interpreter with the -B flag, for example:-
python -B foo.py