Trying to remember a sci-fi book I read in the 70s about a boy/young man getting caught and put on a prison planet that was "hell-like". He eventually escapes.
Chthon is a sci-fi novel of some note, being a finalist for Best Novel in the 1968 Hugo Awards. You read your book in the 1970s; Chthon was first published in 1967 and reprinted in 1972 and 1975. The story matches every point of your sparse description. The protagonist is a young man in his twenties for most of the story; in the earliest scene, he is a boy of seven. He is condemned to the garnet mines of Chthon, and he eventually escapes. The mines are hellish in that they are underground and very hot.
Plot summary from Wikipedia:
The novel is set around 400 years after humans have achieved interstellar travel. Many different planets have been settled and a strange malady called the chill is sweeping the galaxy. The chill affects whole planets in regular waves and kills over half the population unless they flee the planet immediately on experiencing the symptoms.
The protagonist, Aton Five, is from a powerful farming family on the planet Hvee. The Five family has fallen on hard times since the death of Aton's mother, which led to Aton's father, Aurelius, abandoning his farm for a time to seek solace on other planets. Aton is expected to become a successful farmer and restore the fortunes of his family. This allows his father to secure a betrothal between Aton and the daughter of another powerful family. However, Aton meets a strange and extremely beautiful woman in the forest named Malice. He develops an obsession for her and, ignoring his father's warning that she is a legendary and dangerous siren called a minionette, leaves Hvee to search for her, abandoning his betrothed before even meeting her.
Aton encounters Malice but she is disguised and he does not recognise her. He tells her of his mixed feelings of love and hatred for the minionette, and of the agonising futility of his search. His anger and misery draw Malice close to him but, once Aton recognises Malice, his attempts to romance her and make love to her push her away, further inflaming Aton's obsession. Aton returns to his father on Hvee and promises to tend the farm and marry his betrothed if his father can rid him of his obsession. His father sends him to a retreat planet where he is cared for by a beautiful slave girl named Coquina. The pair fall in love and realise that Coquina was Aton's bethrothed from Hvee. Coquina had left Hvee and put herself into slavery following the shame of Aton's abandoning her and their families had secretly set up this reunion. Aton promises to marry Coquina but then almost kills her after having a vision of Malice. Deemed to be beyond salvation, Aton is given a life sentence in the underground prison of Chthon.
Chthon is a garnet mine in which the inmates trade garnets for food. An upper level to the prison houses the less dangerous criminals where the garnets are fashioned. Escape from the upper level is impossible since all of the underground tunnels have been sealed off. The garnets are actually mined in a lower level reserved for criminals too dangerous to live peacably in the upper level. There are rumours that escape from the lower level is possible through uncharted labyrinthine caverns. When the inmates in the upper level learn that Aton's crime was to love a minionette, he is deemed too dangerous to remain, but willingly goes to the lower level since his only interest is in escaping and finding Malice.
Once in the lower level, Aton reasons that he is unlikely to survive an escape attempt alone so he manipulates the inmates into a failed revolt against the upper level. The upper level cuts off food supplies in retaliation forcing the entire inmate population to attempt escape. One by one, the inmates are killed by an unseen monster known as the chimera until only a few remain. In the final stretch of the escape, a mucus starts to build up in the throats of the survivors, sapping their strength and will until all but Aton succumb to a form of zombification. Aton learns from the zombies that the caverns of Chthon are so complex that they have formed intelligence. The zombies are now servants of Chthon, but Chthon requires willing agents and promises Aton sanity in return for his service. Aton insists he needs to find Malice and Chthon releases him. Unknown to Aton, Chthon considers mankind to be evil and is planning its destruction through agents such as Aton.
On reaching the surface, Aton meets a man who claims he is searching for Chthon so that he can appropriate the garnet mines for himself. In reality, this man is Bedside, the only other person to have escaped Chthon but now a willing agent. Bedside goes with Aton as he travels to Malice's home planet of Minion. Aton finds that the female population of Minion, the minionettes, are all identical to each other and are semi-telepathic. Their beauty and youth can be maintained eternally by negative emotions, whereas positive emotions cause them pain and sufficiently intense love kills them. Aton realises that this was why Malice was so attracted to him when he was most despondent and frustrated.
Aton returns to Hvee and finds and confronts Malice, where he comes to realise that he has been blinding himself to the truth and suppressing memories. He finally accepts that Malice is his real mother, conceived when Aurelius was filled with sadness following the death of his previous wife. Malice has been attempting to instil her culture on Aton, with its inverted emotions, so that he could be brought back to Minion. As the son of a minionette, Aton is himself semi-telepathic and delights in negative emotions such as the fear and pain of his fellow inmates as they were devoured by the chimera in Chthon. This perverse aspect to his nature was why he had been unable to love Coquina and had been imprisoned in Chthon. Aton is repulsed by this aspect of himself and Malice realises that trying to bring out his Minion nature would only push him back towards Chthon. Her compassion (in her terms) for him cannot allow this so she ceases her attempts and allows him to love her in "normal" terms, sacrificing her life in an effort to save him.
Aton sinks into madness after Malice's death but is cared for by Coquina under heavy sedation while his mind repairs itself. Bedside insists on taking Aton back to Chthon and Coquina is forced to wake him. Aton confronts Bedside and Bedside suggests that Chthon can stop Aton's internal conflict between his Minion and human natures. Bedside goads Aton into a violent outburst, but Aton stops short of murder and realises that Malice's sacrifice and Coquina's care have worked and that he is finally able to overcome his Minion nature. He returns to Coquina only to find that she is dying of the chill which has recently struck Hvee. She chose to continue caring for Aton rather than leave the planet to save herself. Bedside has followed Aton and makes a final offer that Chthon will save Coquina in return for Aton's service. Aton agrees. Chthon, meanwhile, realises that humanity is not wholly evil and its view of mankind had been skewed by the criminals and madmen that had been imprisoned within the caves. Also, in curing Coquina, Chthon finds that the chill is an unintended side effect of a message sent by a superior intellect across the galaxy.