I watch a lot of historical shows set in England, people were starving and a lot of people would hunt but got caught and would get hung or be shot. Why? It seems like they wanted their people to starve to death
Poaching was illegal hunting was not.
To go into a little more detail about the other commenter poaching consists of hunting on land which you do not own, the vast majority of suitable hunting grounds where either owned by a relatively small number of wealthy land owners or the crown. Additionally, hunting rights were limited to those who owned at leas £100 worth of land in 1671 which as a significantly greater sum at this time than it is today.
On the subject of the punishment this wouldn't have been a capital crime in the 17th century however between 1723 and 1823 Britain passed through a period known as the bloody code in this case the Black Act being the most relevant. Particularly in the first half of that period as Britain's urban population was increasing while economic problems surrounding a major economic crash in 1720 caused a spike in inter-class tensions and increased fears surrounding crime and disorder among many wealthier people. Meanwhile although poaching had been a relatively common crime prior to that many people found it concerning that there seemed to be a spike in organised groups of poachers that worked together to do it and occasionally got in fire fights with gamekeepers and the like. Due to the resultant political pressure this caused and a few high profile poaching gang raids a trend involving the increase in the number of capital crimes surrounding poaching as well as other property crimes like theft increased dramatically. However, the number of executions tailed off towards the end of the 18th century as alternative punishments like transportation began to be used instead of executions while many juries where reluctant to convict people on many property crimes if they thought the defendant was likely to be executed. Eventually in 1823 changing social norms surrounding the acceptability of execution on the scale it was committed declined and the increasing viability and usefulness of transportation as a punishment as part of British empire building as well as changing class relations resulted in capital punishment becoming a mandatory sentence to a small number of crimes such as murder and treason. The number of punishments where it was an option would decline in the decades thereafter.
Prior to the bloody code fines, the use of punishments like the pillory and sometimes imprisonment was more common, however for early modern governments imprisonment for long periods for large numbers of criminals was impractical simply because it was too expensive for the government to pay for that kind of thing, as such they tended to avoid using imprisonment as a punishment for most crimes with prisons largely being used for those like debtors and people awaiting trial. After the end of the bloody code in 1823 transportation was a common option for more offences and steadily overtime the government increasingly began to build up towards the modern prison system as we know it today.
As for going a little more into the details why, on the one hand certainly class tensions where a major reason why hunting became restricted to wealthy land owners and the punishments for it became so harsh and certainly there where land owners who cared little for the wellbeing of the poorer people of the country but the purposes of the laws weren't in order to make sure people starved to death they were about wealthy people defending what they saw as their property rights. There's no where near enough game in Britain to support its population by making that a significant amount of a significant proportion of people's diets. Over the centuries and millennia the population had grown far about the point that was easily viable while the amount of forests had been reduced over the centuries to make room for more farmland. As a result wealthy land owners want to ensure that the stocks of game they owned weren't hunted to the point there were few if any left on their land leaving them with less to hunt for themselves. I would suggest that potentially that hunting also people less reliant on state and capital structures and institutions as a social threat but i'd have to look into that topic more to decide if there's enough evidence to support that kind of notion being significant.