Why are there both state and federal governments?

Federal governments make laws for the whole country. The state governments can make laws for their state ONLY; such as a driving age.