If you just mean the purpose of a function then see immediately below. If you mean f of g where f and g are two functions, go to the end.
The purpose of a function is like giving someone a to-do list. A function (normally shown as f(x)= meaning "function of x", or y=) will usually contain one variable, usually represented by x. Some functions may have more than one variable. If x isn't the variable, it will usually be a different letter like t or a or any letter. Let's say it is x. This variable will appear in a formula with numbers. The formula is the function and it contains instructions in symbols telling you what to do with the variable. For example, multiply the variable by 2 then add 3 and divide the result by 4. This would be written f(x)=(2x+3)/4 or y=(2x+3)/4. The equals sign means that the function is defined as the expression on the right. Just like someone might say to you, think of a number (that's x), but don't tell me what it is, then double it and add 3 and divide the result by 4.
Functions can be plotted on a graph. The idea of this is that on the horizontal axis (x axis) you have markers for 0, 1, 2, etc. On the vertical axis (y or f(x)) you also have markers. The graph is usually a continuous line, and every point on the line is made by putting a different value for x and marking the point (on a rectangular grid f(x) units vertically and x units horizontally) for the result of working out the value of the function for different values of x. The points make up the graph. You can use the graph to find the value of x for any value of the function, and the value of the function for any value of x, provided the graph extends far enough.
This is just a brief example of the purpose of a function. A practical example is the conversion of temperature in degrees Fahrenheit (F) to degrees Celsius: C=5(F-32)/9. This function tells you what do with the value of the temperature. You could plot this as a straight line graph and you can read off degrees C for any temperature in degrees F, and vice versa. Another example is d=30t where d=distance, speed=30mph, t=time. The function is 30t, and from it you can work out the distance a car moves in a particular time t when its speed is 30mph.
Function of a function: this simply means you work out the value of applying one function and then feed this answer as the variable into the other function. An example could be that one function is used to find out how many miles a car travelling at an average speed of 30mph in a given time. The second function could be to find out how much fuel is used to travel that distance. So g(t)=30t is the first function. The second function is h(d)=d/24 where fuel consumption is 24 miles per gallon. h of g is h(g(t))=30t/24=5t/4.