Beyond the Hype: A Deep Dive into How Generative AI Works