All organisms need energy to survive. Animals receive energy by consuming food. Conversely, plants do not eat, and cannot absorb all the energy they need from the soil. Thus, plants have evolved another means of obtaining energy - they make use of energy from the sun. However, plants cannot use the sun energy directly - they must capture the light and convert it into chemical energy.
Photosynthesis is the process by which plants convert the energy of sunlight into carbohydrates (sugars). These sugars are then stored and consumed when the plant requires energy. Photosynthesis takes place in the chloroplasts of the plant cells. Note that some bacteria are also capable of conducting photosynthesis.
Thus, we can say that the purpose of photosynthesis is to convert sunlight into a useable form of energy.