Ok so there are some wrong or incomplete answers above. I am not going to try and pick the truth and fiction apart above.
I already posted this elsewhere today, i'll just copy it here:
First I need to make sure you understand there are two things at work here:
Each unit can actively attack once per game hour on any target within their range. (game hour is affected by speed factors)
Each unit will defend themselves from each attack using their defense stats. The easiest way to consider this is they return fire every single time they are fired upon using their defense stats. This can occur an unlimited amount of times per hour in addition to the active attack.
In many situations a passive defense is desirable as the defending stats may be stronger than the attacking stats for a particular engagement, or due to the number of groups involved. Regarding ground battles of this type the calculation of both the attack and return fire occurs first (based on current values) and then the damage is applied to both sides at the same time. (Notably different is standard air combat where air defenses are calculated first damaging or destroying the attacking plane before the attacking value of the plane is calculated)
Perhaps a summary like this will make sense to you:
Attack is an action that is permitted once per game hour per unit/group
Defend is a reaction. Every single time that a unit is attacked it returns fire using the defending line of their statistics.
[size=12]So now that you understand what attacking and defending is, we can explore which one is which. This is actually a trick question to see if you really understand, because every unit can be the attacker, and every unit WILL BE a defender against any attacker.
The key point to all of this is:
[size=36]Defending is the response to every attack.[/size][/size]
________________________________________________
So with that in mind, lets look at what triggers an attack:
1) Moving units will attack enemy units that they encounter
2) Moving units will attack province centers that they encounter.
3) A change in orders, such as clicking stop or forced march will cause a unit to attack targets within the 5k close combat range
4) Issuing a new move order will also cause a unit to attack targets within the 5k close combat range
5) A use of the "attack" button will cause an attack.
And one last tidbit: Being attacked does not prevent a unit from ALSO attacking, either the unit that attacked them or any unit within range. A unit is also free to change their target during the engagement.
Happy hunting.