GDP is a method to measure the size of nation's economy. It is generally taken as a proxy for nation's well being. There are other measure's like Quality of Life etc which can claim to provide holistic view of nation's well being. However, the difficulty in measuring it makes this measure inviable.
GDP can be calculated using 2 approaches: income and expenditure. The expenditure approach is generally preferred. Using this approach the GDP is calculated as:
GDP = C + I + G + NX
C --> Consumption by private households on consumer goods (durable and non-durable) and services (rent, medical etc).
I --> Investment by businesses. Investments are defined as spending now in order to increase output later. This also includes consumer's purchase of new housing.
G --> Government spending on goods and services. It includes salaries of government employee, defense expenditure and any investments by government
NX --> Net Exports measured as the difference of Imports (M) from Exports (X). Therefore, NX = X-M.