Here’s a detailed write-up on the specific episode in Attack on Titan Season 1 where Eren Yeager first transforms into a Titan.
During the battle for Trost, Eren is initially believed to be dead after sacrificing himself to save Armin from being swallowed by a Titan. While trapped inside the Titan's stomach amidst the corpses of his fallen comrades, Eren’s sheer rage and will to survive trigger an instinctive reaction.