In the Catholic Church, any baptized male Catholic can technically become a pope.
We can read in the Code of Canon Law
A baptized male alone receives sacred ordination validly.
But the last time that happened was in 1294 pope Celestine V.
However, in practice, the College of Cardinals, which is made up of high-ranking Catholic clergy, elects the pope. Typically, the pope is chosen from among the cardinals, although there is no strict requirement that the pope must be a cardinal.
The last non-cardinal elected pope was Urban VI in 1379.
The selection process occurs during a papal conclave held in Vatican City following the death or resignation of the previous pope. The conclave is guided by specific rules and procedures outlined in church law, and the cardinals gather to prayerfully elect the next pope.