There are several ways but one way would be
{{ state_attr('sensor.grocy_stock', 'items')[2]['_name'] }}
This would return the name of the third item (_product _id: 5). The template is Jinja (Google it) which is basically python code between the curly braces. You can use the Developer tools/Templates in the HA UI to try this out real time and help you get your syntax right. Give it a try.