Differences:
An electrical motor converts electrical energy into mechanical energy,where as a generator converts mechanical energy into electrical energy.
The principle of a electric motor if there is a change of the magnetic field across a conductor electrons are forced to move in a direction perpendicular to the direction of the magnetic field,where as in a generator if a charge is moving in a magnetic field, a force acts on the charge in a direction perpendicular to both the velocity of the charge and the magnetic field.
similarities:
Both electric motor and generator work on the magnetic effects of electric current.
Both have the armatures to rotate the loop.