Can a pope become a heretic? If so, what happens?
Generally speaking heresy is traditionally considered to fall into two categories:
material heresy: the unintentional erroneous definition of a article of faith. This can happen when someone over emphasizes a particular aspect of an article of faith or in a good faith effort to simplify a teaching over simplifies it. Material heresy is not considered a sin nor does it invoke any canonical penalties. It is seen as just a reality that comes with human attempts to speak of the divine.
formal heresy: the deliberate rejection of a defined article of faith. Formal heresy is a sin and invokes canonical penalties.
For example, if someone was to describe the relationship of the Trinity as like the sun (the Father is the sun itself, the Son is the rays of light from the sun, the Holy Spirit is the warmth of the sun) they would technically be speaking heresy. Someone using that analogy could truly believe everything the Church teaches about the Trinity but doesn’t realize that the analogy’s inner logic could be used to lead to the heresy of Modalism or Arianism. Such a person would certainly not be a formal heretic even though their attempted explanation falls short (material hersey).
When speaking ex cathedra the Church teaches that the Pope’s teaching is excluded from all possibility of material heresy by protection of the Holy Spirit.
When speaking outside of the realm of infallible teaching, the Pope could possibly wind up in material heresy. In such a situation the Pope would not knowingly or intentionally be rejecting any definitive article of faith, but his wording might be a bit sloppy or be over/under emphasizing something that might give an erroneous impression.
In such situations we have the college of Bishops to help the Pope clarify the teachings.
Could the Pope ever be a formal heretic outside of an infallible teaching? The answer to that question seems to be: no, the Pope cannot be a formal heretic. It would appear to be contrary to the promises of Christ to St. Peter (Mt 16:18; Lk 22:32; Jn 21:15-17) that Christ would ever permit the Pope to fall into formal heresy.