A current is produced in the generator which would oppose the magnetic field (usually of permanent magnets). This is Lenz's Law in action. And I second taking a look at the Wikipedia articles on generators and motors, which will give you a high-level introduction to this topic. After that, perhaps an introductory electromagnetics textbook? You're asking a lot with this question.