The word function basically means an operation in Latin. Well, that captures the essence of what a function is. A function is similar to a machine (or a computer program). Just like in a machine you give input and it gives you a corresponding output according to some prescribed rules, a function takes in a number and gives another corresponding value.
It is not necessary, in a strict sense, that the input and the output of a function are numbers. They can be anything. But in the present case (and in most of mathematics), we will be dealing only with functions that deal with numbers.
For example, we may have a function that takes in a real number x and gives x2. That is, if you input 1 in this machine, it will give you 1; if you input 2, it will give you 4, you input 3, you get 9, and so on…
So, the rule that this machine follows is taking a number to its square. In mathematics, such a rule is denoted as f(x) = x2. Similarly, f(x) = x3 takes any real number to its cube; f(x) = x/2 divides a real number by 2, and so on.
On a short note, that’s what functions are.