Henry VIII was what a good Christian was in his era - he believed implicitly that he would be judged and go either to heaven or hell.
Catherine of Aragon had been married to his brother Arthur, and when Arthur died, their father Henry VII decided that to avoid having to send back her dowry (already spent!) his new heir Henry would marry the widow. Arthur had been a sickly youth, and there was some doubt about whether the marriage had been consummated (Arthur boasted the morning after the wedding that "last night I was in Spain", but then he would, wouldn't he?)
Henry had married and lain with his dead brother's wife - a sin - so he believed that God was punishing him by denying the marriage a male heir to carry on his line.
He was also a superb politician, who knew the chaos that a female successor could cause within the kingdom and with foreign aggressors, and he was right in that. He was several years younger than post-menopausal Catherine, and had proved already via Ann's sister Mary that Boleyn girls could bear sons. Add in ambitious courtiers playing on his guilt and willing to push their womenfolk in his direction.
His divine task was to rule the kingdom and hand it on safely to another strong king.