As a unit fights and survives battles, it gains experience points that improve its ability to deal with future combat situations. Their first experience level is gained by taking 25% casualties, regardless of the number of kills made. Amongst other things, experience increases morale, so an experienced unit is then less likely to break and run from battle when under stress and fatigue. Generals also gain experience points upon successful conclusion of a battle that can be used to choose useful military skills for them.
Experience for ship crews works in the same way as it does for units, except that when a ship is unable to continue fighting - either due to surrender, routing or its destruction - all remaining experience points that its crew might have earned are instead split between the ships it was in combat against.