I’m fairly new to C++ so this might be off base, but most languages do this, C++ just does it a specific way because of history.
A lot of it deals with how the compiler works I am guessing. Header files are similar to interfaces it seems, if you know what interfaces are from higher level languages like Java. Simply put, they tell the compiler what it can and cannot do without knowing precisely how everything works, and thus doesn’t need to keep everything loaded in memory. This should also, in theory, allow the compiler to compile mostly baaed on those header files. As long as class/function signatures (function names, arguments, return types, variables, etc) don’t change, there is no need to re-build that section of code since the actual implementation is looked up as needed.
There are also some other benefits this provides, as it promotes you to think about what is implementation (what something does) and what is declaration (what something is capable of receiving/giving, what is available, etc). It helps with checking for logical errors and that kind of thing.
To give a little example, if you have a function called DoubleMe like in the course videos, and it takes an int and returns an int, you can change how you double something all you want. Since the declaration hasn’t changed, the compiler doesn’t need to care. The moment you change that function to DoubleIt, or make it return or take in something else, then it will need re-built since the rules have changed.
Again, I am pretty new to C++ and a lot of this is based off assumptions and what I know about programming, so feel free to correct any misunderstandings I have.