Both devices involve spinning coils of wire within a magnetic field. The fundamental difference is in the purpose of the spinning. A motor converts input electrical current and energy into spinning mechanical energy. A generator does the reverse.
Work Step by Step
In principle, motors could be used as generators, and vice versa. This is discussed on page 473.