It was when he saw the Simonites getting punished. They sold ecclesiastic favors to gain riches and were being punished by being hung upside down with their feet on fire with baptismal oil. Dante abhorred the corruption of the Church and this was one way he inserted it into his work.