In many physical phenomena, laws an relations to their variables are somehow interpolated (example by statistical data or samples) and then an approximate set of functions are generated to work equivalently within the allowable range. Is there a branch of mathematics that treats this in details?
There are many different ways in which people "generate a function out of a graph" belonging to different fields of math and physics: The relevant field and method depends on the goal and application.
First, there is interpolation. Linear interpolation is one example: draw line-segments between consecutive data-points, and use the value of the resulting piecewise curve to estimate what you might find if you measured between your data points. A particularly popular interpolation method is the so-called cubic spline. Computing cubic-splines and linear interpolations is a deterministic procedure that doesn't need any fitting algorithm. This is sometimes useful when you have a very pragmatic application in mind. For example, you measure the voltage as a function of temperature for a thermocouple, and then later you want to calculate the temperature given a specific voltage measurement.
Then, there is curve-fitting. This is exactly what it sounds like: given a function with a set number of parameters, the parameters are adjusted until the resulting "best fit" is found. Most algorithms that do this start from some initial guess for the best-fit parameters, and make "small" changes to the adjustable parameters until the fit no longer gets "better". Typically the parameter step-size is adjusted dynamically by the chosen algorithm, and the fit quality is evaluating using a so-called quality function. Often one does this if one knows a functional form that well-describes the data that one wants to fit. For example, if I measured the height of a falling body as a function of time, then I would likely try to fit the data using a least-squares fit of a quadratic equation.
A "higher form" of curve fitting is to fit a set of data using a finite number of terms in a systematic expansion. This has the theoretical advantage that there exist systematic expansions that can in principle describe any function. For example, expanding periodic data in Fourier series is often a very good idea. Noteworthy as well are polynomials; actually arbitrarily fitting high-degree polynomials to experimental data is often a terrible idea. My justification for saying this is that all non-constant polynomials diverge at $\pm \infty$. Thus, no matter how many terms you add it the expansion, if you fit something that e.g. decays exponentially using a polynomial, then you will end up with wildly unrealistic results far from the point about which the expansion was computed.
Somewhere higher on the complexity ladder is so-called phenomenological modelling. Phenomenology sometimes gets a "bad rap", but it has its place. Often the name of the game in phenomenology is to simply write down a functional form that one thinks well describes the experimental data in question. Usually, however, one injects some "physical insight" into the choice of the functional form. An example of a model like this is the liquid-drop model in nuclear physics. In that model the binding energy of atomic nuclei is described as the sum of various terms each obeying different power laws, with analogies to physical effects such as surface tension, coulomb interaction, and so forth. Personally, I find that particular model highly unsatisfying. However, if one wants to calculate the energy released in any nuclear reaction using only a few parameters, then it does a pretty good job.
At the top of the totem pole in my opinion is "real" theory. This is traditionally the job of a theoretical physicist, although mathematicians, chemists and all manner of other people do similar things. To put a personal spin on it, this is my job, most of the time at least. In my world the role of a theoretical physicist is to look at all of the experimental data and see if it can be understood consistently and within one model. Ultimately, you will be looking at many different "graphs", and your work will hopefully generate some "functions" that can be compared with those graphs, and make predictions for data that haven't yet been measured. In an absurd example, one might look at the distance a freshman wanders home from a bar. In a very bad case, it might be the case that such motion is well described as a random walk, or perhaps a Levy flight. If they are totally sober, however, ballistic motion would be a good description. In-between there might be something like super-diffusive motion; hopefully subdiffusive motion never occurs. One can write down equations for each of these different models, and re-arrange them to derive functions to compare with the data from a graph, if that's what you have for data. Using the resulting equations, one could predict what time the freshman would ultimately arrive at home.
The branch of mathematic called modeling gives you a idea of the type of curve you may want to use.
Statistics helps you in knowing whether your sample is correct (is the number of experiments enough, what is the experimental errors,... ).
Curve fitting, with optimization is used to adjust the parameters and minimize the difference between your data and you model.
Simulation is when you use your model to mimics reality (how many replicas, what is due to randomness and model inaccuracy...)
This is not a part of mathematics and you will find a lot information there, but be ready to enter in a new universe.