You choose a distribution that you like, say Gamma, and then enter the data into your appropriate software and apply a program that compares the data with your chosen distribution. You then obtain an AIC value that you can compare with other AIC values using other distributions. The lowest AIC means the closest fit :)
The aim of distribution fitting is to predict the probability or to forecast the frequency of occurrence of the magnitude of the phenomenon in a certain interval. Always we have several candidate distributions, which should be examined to select the one which would be fitted more closely to the observed frequency of the data than the others.
You may find several R packages for fitting distributions to data.
As you mentioned here about distribution, that is so true we have to select a distribution and fit our datasets as per the different types of distribution available. So, do you mean that the fitting of any data set depends on the type of distributions we select ?? In general, how can we explain the fitting terms here..