There are enough answers explaining what a function is in general, so instead, I'd like to look at a particular function and discuss that.
Consider the graph of me walking to the grocery store to buy some pickled herring. I don't buy it all of the time, so when I go to the store, I really have to look for it.
On the horizontal axis is time ($t$), which represents the number of minutes since I left home, and on the vertical axis is the distance $(d)$, in meters, which represents the distance that I am from my house.
Initially, the distance (from home) is increasing. This represent my walk to the store.
Then it alternates between increasing and decreasing as I go up and down the aisles because the west side of the store is closer to my house than the east side of the store is. What is interesting about this part of my trip is that I can be the same distance from my house at different points in time. In fact, I am $350$m from home no fewer than $6$ times. At times, I may even be in the same location, but I can never be in $2$ places at once (this is really what the vertical line test will tell me).
Finally, are the last two legs of my trip. There is a horizontal leg to this function, which represents me waiting in line at the cashier, and not moving at all, hence not going further away nor closer to home. And lastly, I gradually decrease my distance until it reaches $0$m (at about the $28$ minute mark).
There are a multitude of other scientific relationships where one quantity depends on another that are modeled as functions. Think about throwing a ball up in the air. The ball can be at the same altitude at two different times (on the way up, and on the way down), but cannot be at two different altitudes at the same time (there's that vertical line test again).
By the way, the pickled herring was delicious.