OEM (Original Equipment Manufacturer) parts are made by or for the vehicle's original manufacturer to the exact factory specification, while aftermarket parts are made by third-party companies and can vary widely in quality and price — both are legitimate choices depending on the situation.
OEM parts: the tradeoffs
OEM parts are guaranteed to match the vehicle's original specifications exactly, which matters most for fit-critical or safety-critical components. The tradeoff is cost — OEM parts are typically more expensive than aftermarket alternatives for the same job.
Aftermarket parts: the tradeoffs
Aftermarket parts range enormously in quality — some are made to equal or near-equal OEM specifications at a lower price, while others are genuinely lower quality. A reputable mechanic can usually recommend trusted aftermarket brands for a given job, rather than treating all aftermarket parts as equivalent.
How to decide
For safety-critical systems (brakes, steering) many people lean toward OEM or well-reviewed premium aftermarket parts; for less critical components, a quality aftermarket part is often a reasonable way to save money. A good mechanic should be willing to explain which option they're recommending and why for your specific repair.