To found a kingdom one has to take a castle while not a lord or a mercenary to any faction. You will be given the castle, and you will choose your faction's name and a minister of either a local or one of your companions. Your faction's colour will be red. You will be able to move your court once you have more places, and you can send emissaries to different factions, and declare your lords (you can choose your companions to be lords) traitors.
Another way to create your own faction is to conquer a castle or town while you are a vassal of a kingdom and then request to be awarded the fief. After a few days the king will either grant you the fief or deny it and give it to someone else. If you are not given the fief you'll be offered an small sum of denairs in exchange and then you can either accept the king's ruling (get the denairs offered and the fief goes to someone else) or defy the King's ruling. In the later case you'll be faced with another question with three possible answers: Remain Loyal to your liege (the fief goes to someone else, you remain in your faction, you get no money), Denounce your liege and lose your fiefs (you leave your faction, you relations with your liege goes down, you become a free lord), Denounce your liege and don't return the fiefs (you leave your faction, you keep your fiefs, you create your own faction, your faction is at war with your former faction, your relation with your leige goes down).