Both interpreter and compiler come into play when a human is coding in a high-level programming language. This term means that the language resembles a human language - uses words such as for, if, else etc. High-level programming languages are easily understood by a human, but they are impossible to be understood by a computer. Computers require instructions in machine code, encoded in binary.
The translation from a high-level language is necessary - and is done by either a compiler or an interpreter. So, both interpreters and compilers translate the source code into another language - usually machine code. They do however take a different approach. The interpreter reads each line of the code individually (usually executing it in the process, scanning for any mistakes it encounters, and stopping when one is encountered) - meaning that the whole programme can be executed quicker. Compiler, on the other hand, scans the whole programme at once. It then provides you with the translated file (for example .exe files in Windows systems) - this file can be run quicker than if you used interpreter each time, as it has been shortened (while retaining the meaning) by the compiler. However, compilers are not good at debugging - even if a mistake is encountered, you will be informed about it only after the whole programme has been scanned.