To level up a Mercenary, you need to gain experience for them. You receive experience points by fighting battles and completing quests. These points are then converted into levels. So the more fights you participate in, the faster your mercenary levels up.