We use it to substitute an unknown number. We have a variable for a number we don’t know and as we solve the problem we can find the answer for the variable or unknown number.
They are used for a number we don't know what is exactly. As we solve the problem, we learn what the number could be, but when we don't know a certain number or have to solve for the unknown number, we use a variable to substitute for it.