Charm person makes a humanoid "friendly" to you, as per the rules found in the Diplomacy skill, but it also allows you to issue orders to the target, making an opposed Charisma check to convince the target to do something that it would not normally do. How does that work?
The charm animal spell (and charm person / charm monster spells by extension) makes the target your friend. It will treat you kindly (although maybe not your allies) and will generally help you as long as your interests align. This is mostly in the purview of the GM. If you ask the creature to do something that it would not normally do (in relation to your friendship), that is when the opposed Charisma check comes into play. For example, if you use charm person to befriend an orc, the orc might share his grog with you and talk with you about the upcoming raid on a nearby settlement. If you asked him to help you fight some skeletons, he might very well lend a hand. If you asked him to help you till a field, however, you might need to make that check to convince him to do it.