Bismillah Hir Rahmaan Nir Raheem
As Salaamu 3laykum,
I hope you are doing well. I would first like to correct the title and the question. The question should be why the certain types of punishments are given in the Quraan. Because to say they are gruesome is your personal opinion/perspective. However, punishment does not go by how we think it should be but by how ALLAAH (Glory Be To Him) decides it to be.
Furthermore, the punishments listed in the Quraan are not only for those who disbelieve but for those who believe as well unless stated otherwise.
Moreover, to your question with regards with the punishment and their purpose. We can find the answer here in the Quraan:
[As for] the thief, the male and the female, amputate their hands in recompense for what they earned [i.e., committed] as a deterrent [punishment] from Allah. And Allah is Exalted in Might and Wise. (Chapter 5 verse 38)
You might be wondering how is this an answer. It's because if the punishment here is a deterrent then the punishment in the hereafter is a larger deterrent. Because either you are forgiven here, sins are forgiven on the day of judgement or the sins gets transferred to the hereafter and you are punished for it.
Proof from Hadith
The Messenger of ALLAAH (Peace and Blessings of ALLAAH Be Upon Him) said, with a group of his Sahaabah standing around him: “Come and give me your oath of allegiance, promising that you will not associate anything in worship with ALLAAH, or steal, or commit zinaa (illegal sexual activity), or kill your children, or utter slander intentionally forging falsehood (by wrongfully attributing illegitimate children to husbands) [cf 60:12], or disobey me with regard to anything good (ma’roof). Whoever among you fulfils this oath, his reward will be due from ALLAAH , and whoever commits any of these sins and is punished for it in this world, this will be an expiation for him. Whoever commits any of these sins and ALLAAH conceals it for him, then his case rests with ALLAAH – if He wills, He will punish him and if He wills, He will forgive him.” (Bukhari)
It is meant as a deterrent and if they don't follow then they can expect that punishment. Also if the punishment was for example just being scratched by thorn or pricked the finger for a drop of blood that would not make anyone scared or fearful of following the correct path. Many people will follow Islam through various ways. Some due to fear, some due to hope in haven and some due to love of ALLAAH (Glory Be To Him).
When it comes to punishments if you look at this world and the many systems set in place. If a person kills someone then the equal punishment is given which is death by hanging, poison, firing, etc. Or someone is given a punishment suitable to their offense.
However, on the flip side mercy and forgiveness of ALLAAH (Glory Be To Him) overshadows punishment as shown in a Prophetic saying (hadith):
The Messenger of ALLAAH, Peace and Blessings Be upon Him, said, “When ALLAAH (Glory Be To Him) completed the creation, He wrote in His book with Him upon the Throne: Verily, My mercy prevails over My wrath.” (Bukhari and Muslim)
And we see that mercy when we read the following hadith:
I heard the Messenger of ALLAAH (Peace Be Upon Him) say: ALLAAH the Almighty said: O son of Adam, so long as you call upon Me and ask of Me, I shall forgive you for what you have done, and I shall not mind. O son of Adam, were your sins to reach the clouds of the sky and were you then to ask forgiveness of Me, I would forgive you. O son of Adam, were you to come to Me with sins nearly as great as the earth and were you then to face Me, ascribing no partner to Me, I would bring you forgiveness nearly as great as it. It was related by at-Tirmidhi (also by Ahmad ibn Hanbal). Its chain of authorities is sound. (Hadith Qudsi)
And if we look at the Quraan 113 our of 114 chapters start with In the Name of ALLAAH Most Gracious Most Merciful. This shows the mercy and beauty that awaits and the love ALLAAH (Glory Be To Him) that He (Glory Be To Him) has for all of His (Glory Be To Him) creation.
Note I do want to point out something which many may not know of which is that in Islam there are two view points that will hell be forever. The majority say yes however, there is a minority view that says no. To read more about it you can click this link here: https://www.abuaminaelias.com/punished-hellfire-forever/
Overall we see the verses in the Quraan that its not only about punishment. The main goal is to teach that there is only ALLAAH (Glory Be To Him). He (Glory Be To Him) does not have any partners nor any children and nor did was He (Glory Be To Him) born from anyone/anyplace. And when people receive the truth deep down they know however, they will swayed by their peers, family, environment, etc. And the punishments are to show that punishment is much greater and should be much more feared than anything in your life after ALLAAH (Glory Be To Him).
Have a Nice Day!