A generic drug is a copy of the brand-name drug with the same dosage, safety, strength, quality, how it is taken, performance, and intended use. Before generics become available on the market, the generic company must prove it has the same active ingredients as the brand-name and works the same way in the body in the same amount of time.
The only differences between generics and their brand-name counterparts is the generics are less expensive and may look slightly different (e.g. different shape or color), as trademark laws prevent a generic from looking exactly like the brand-name drug.
Generics are less expensive because generic manufacturers don't have to invest large sums of money to invent a drug. When the brand-name patent expires, generic companies can manufacture a copy of the brand-name drug and sell it at substantial discounts.