There are different ways of looking at functions. We will consider a few. But first, we need to discuss some terminology.
A "relation" is just a relationship between sets of information. Think of all the people in one of your classes, and think of their heights. The pairing of names and heights is a relation. In relations and functions, the pairs of names and heights are "ordered", which means one comes first and the other comes second. To put it another way, we could set up this pairing so that either you give me a name, and then I give you that person's height, or else you give me a height, and I give you the names of all the people who are that tall. The set of all the starting points is called "the domain" and the set of all the ending points is called "the range." The domain is what you start with; the range is what you end up with. The domain is the x's; the range is the y's. (I'll explain more on the subject of determining domains and ranges later.)
A function is a "well-behaved" relation. Just as with members of your own family, some members of the family of pairing relationships are better behaved than other. (Warning: This means that, while all functions are relations, since they pair information, not all relations are functions. Functions are a sub-classification of relations.) When we say that a function is "a well-behaved relation", we mean that, given a starting point, we know exactly where to go; given an x, we get only and exactly one y.
Let's return to our relation of your classmates and their heights, and let's suppose that the domain is the set of everybody's heights. Let's suppose that there's a pizza-delivery guy waiting in the hallway. And all the delivery guy knows is that the pizza is for the student in your classroom who is five-foot-five. Now let the guy in. Who does he go to? What if nobody is five-foot-five? What if there are six people in the room that are five-five? Do they all have to pay? What if you are five-foot-five? And what if you're out of cash? And allergic to anchovies? Are you still on the hook? Ack! What a mess!