The idea of utility is very simple. It converts the numerical outcome into the utility to you. Say, you get 10 apples or 5 oranges, or some combination of two. How would you compare apples to oranges? Easy, I offer you to take either of two choices, and you pick one. So, theory goes that there's some kind of a function $U(x_1,x_2,\dots,x_n)$ such that when you feed it a basket of goods $1,2,\dots,n$ with quantities $x_i$ of each good, this function returns a scalar value, which reflects the utility of this basket to you. You pick the one with a greater utility.
So, if I feed it $U(10,0)$ or $U(0,5)$, where the good 1 is apples, and the good 2 is oranges, it'll return two different numbers, the greater one will indicate which basket has more utility to you. YOu can combine goods in the same basket $U(1,1)$ - one apple and one orange.
So, in a nutshell, the utility function is a concept that allows us to compare apples to oranges. The theory states that you pcik the baskets based on their utility, which is calculated by plugging the basket descriptions into this utility function.