When you click on a damaged module in Modules tab, there will be a "Repair" option, if you have AFMU on board. The module goes offline while the repairs are being made. (So don't repair FSD or thrusters in supercruise, otherwise you're in for an abrupt stop.

)
The higher class and rating of the AFMU the more ammo it has and repairs modules faster.
Ammo can be synthesized from materials, or restocked at stations, like normal ammo.
AFMU cannot repair hull, powerplant and itself. (But it can be repaired by second AFMU)
It can even repair a cracked canopy, but can't fix the hole, once it's breached. (Kind of like in the ME:A Prologue)