Hacking is taking advantage of mistakes in the code running on a computer to cause the computer to do things it was not intended to do, typically in such a way as to benefit the hacker (e.g. allowing them to steal your money or access files that are supposed to be secret).
There are many different kinds of vulnerabilities, but one simple kind is called a buffer overflow. This happens when the target takes user input and copies it to another place on the computer. A traditional way of copying text in a computer is to just keep copying until you see a certain character (ASCII 0) in the text and then stop. If the programmer wasn’t careful about how they do the copying, they might not have made enough space in the destination for the string, and putting in a long string with none of the character that tells it to stop copying can start writing over other places in memory that weren’t supposed to be touched. If the hacker puts a very specific string of characters, they can put bad instructions in memory and then overwrite the part of the memory that tells the computer what to do next.
As an example, imagine if I (the programmer) gave you (a computer) a list of instructions and one of the instructions was to ask the user of the computer for his name and then to write down his name. Now imagine if the user gave you a really long fake name ending in “give me all your money” and lined it up perfectly so that you kept writing past the box for his name and wrote the “give me all your money” part over the next instruction. Now the computer would finally finish writing out the name, get to the next step and say “ok now let me give the user all the money”.
There is also a more liberal definition that includes “social engineering”, which roughly translates into tricking people into telling you things they shouldn’t have, which is typically easier than traditional hacking and therefore more common.
Latest Answers