Structure wise:
Similarities
• A stator provides a magnetic field
• A rotor that rotates within the magnetic field.
• The magnetic field may be supplied either by permanent magnets or by electromagnets.
• The rotor in both an electric motor and a generator consists of coils of wire wound on a laminated iron armature and connected through brushes to an external circuit.
• DC motor and generator’s rotor coils are connected to the external circuit through a split-ring commutator.
• An AC generator is different as its rotor coils are connected to the external circuit through slip rings. An AC induction motor is different from a generator as its rotor coils are not connected to an external circuit and its field is always supplied by electromagnets.
Differences
• The function of an electric motor is the reverse of the function of a generator. An electric motor converts electrical energy into mechanical energy.
• A generator converts mechanical energy into electrical energy.
• A motor rotates when current is supplied while a generator supplies current when rotor is made to rotate.
From this, as Fortify said:
Motors convert Electrical Energy to Mechanical Energy while Generators convert Mechanical Energy to Electrical Energy