XP, which stands for Experience Points, is earned by completing all the various tasks, quests and activities in the game. As you earn more and more XP, you’ll advance in levels. Besides looking cool, you’ll unlock access to many new buildings and decorations in the game as you reach the higher levels.
In CityVille you usually gain one or two XP points for each action you do, it does not matter how long it takes to complete...