The generals are your Facebook or Google+ friends which you appoint in Officer's Quarters . If your friends that you appoint also play the game, they will cost 50% less per hour (10 gold/hour instead of 20 gold/hour) . Each attack you send requires a general, but spying does not.

To upgrade a general up to 5 star you need to win 13 battles with him appointed. The fastest way is to attack the closest wilderness of lv1 with enough army to win and with the general that you want to train. Each time your general levels up it will increase the battle effectiveness of the army sent out under that general's control.

If you lose the friend on facebook, you do not lose the general... DoA also has generic generals you can choose to lead your battles.