Leagues are a big function in Castlot. You can join leagues of the same faction but not opposite faction. You can socialize with the people in your league and make friends.
There is also technologies that you can achieve as you level up your league, but you need to contribute gold and resources to level it up.
As you level up and leave Beginners Protection, you will have to be in a league to get protection from the members around there. As normal Castlot members go, they target leagueless players because they know that nobody will be able to protect them. Its always best to join during the beginning of your gameplay to be protected by other larger players and so they can help you learn more about the game.