While some argue that the primary purpose of the European Union was economic, rather than political, such a conclusion can really only be reached by ignoring the entirety of post-World War II European history. While the structures and arrangements that comprise the European Union are largely economic, the purpose of European integration is entirely political. Weary of centuries of highly-destructive uninterrupted warfare culminating in the most destructive conflict in human history, and seeking to replace the old "balance-of-power" model that had failed spectacularly twice in the same century, the leaders of West Germany, France, the Netherlands, and other West European nations sought to eliminate the political divisions that repeatedly resulted in these conflicts by integrating both politically and economically. By agreeing to common political and economic principles, the previous structure of independent nation-states would give way to a unified decision-making structure combined with economic integration that would allow each member state to specialize in areas on which it was best suited to focus. The catch, of course, was that each member state had to be prepared to sacrifice certain economic practices, such as in the area of agriculture, for the greater good. Agricultural sectors, especially in France, however, remained so politically powerful that they were able to impede the process of integration for many years.
As noted, much of the discussion and activity involving the European Union focuses on economic issues. The current conflict regarding Greece's impending bankruptcy, for instance, illuminates the extent to which economic issues dominate the E.U. The European Union, however, was established primarily for political, not economic reasons.
The European Union's primary purpose was meant to be more economic than political. Its scheme of law and regulation is meant to create, in some ways, a cohesive economic entity of its countries, so that goods can flow freely across the borders of its member nations, without tariffs, with the ease of one currency, and the creation of one enlarged labor pool, which should at least theoretically create a more efficient distribution and use of labor. There is a pooling of financial resources, so that member nations can be "bailed out" or lent money for investment, and at least theoretically, member nations are more likely to cooperate than compete.
There are political implications to this union, of course. For example, member nations are expected to conform with the Union's expectations in areas such as human rights and the environment, and the Union can exact a heavy political cost on its members as a condition of giving aid, as it did in Greece, insisting on severe cutbacks and an austerity budget, which had tremendous political costs for Greek leadership.
There can be political fallout even for countries that are not part of the European Union. Ukraine, for instance, which is divided on whether or not to seek admission to the union, is presently engaged in almost a civil war between those in the west who want to be part of the Union and those in the east who would prefer to align themselves with Russian interests.
This is a great experiment, really, in cooperation amongst nations, who wish to be economically unified, ceding as little political and national power as possible, and it will be interesting to see how this unfolds. Will the European Union come to resemble the United States, or will it devolve into its previous collection of separate economic entities?
The overall function of the European Union is to create and implement laws and regulations that integrate the member states of the EU. The countries of the EU are supposed to have uniform laws and policies concerning a variety of things (like immigration, labor, weights and measures -- all sorts of things). The function of the EU government is to decide how this integration should be done and to carry it out.
For example, 16 members of the EU use the Euro as their currency. One of the functions of a part of the EU government was to devise the currency -- to decide what it would be called, what it would look like, etc. Another part of the EU government tries to get countries using the Euro to enact fiscal policies that will keep the Euro stable. They try, in other words, to prevent fiascos like what happened in Greece this past year and they try to remedy them if they happen.