To be used as a motor:
You connect the motors electric terminals to a power source and then it spins (therfore this is a motor)
To be used as a generator:
You connect a light bulb to the power input terminals of a motor and manually turn the motor and wallah, the light bulb lights up (Therfore acting as a generator).
Basic explanation !