It's brewed from the peel and rind of the pineapple, not the fruit's flesh, which usually gets eaten separately.
Tepache is a lightly fermented drink made by soaking pineapple peels with piloncillo (unrefined cane sugar), cinnamon, and water for a few days until it turns tangy and faintly fizzy. Street vendors ladle it from big glass jars into plastic cups over ice, sometimes with a splash of beer, and it's usually barely alcoholic.