THERE are quite a few moments in Beach Rats, the new movie from award-winning filmmaker Eliza Hittman, when all you see of its main character, Frankie, is his face bathed in the blue light from a computer screen. Frankie is 19 years old and leading a secret life online, web-camming and chatting in an effort to find out who he is, and as he stares at the screen, we stare at him. We are voyeurs as the internet brings Frankie some comfort and support before drawing him deeper into danger. Beach Rats is a film about coming to terms with being gay, but it’s also about what the internet can do to people.

Frankie is played by 21-year-old Harris Dickinson and at first glance the character and the actor look like a poor match. Frankie is an aimless teenager who lives on the outer edges of Brooklyn and the outer edges of his family: his father is dying of cancer and Frankie escapes partly by hanging out with his delinquent friends, but also by flirting with older men online. He is caught between trying to be the tough guy his friends expect him to be, and being the person he really is, and he’s confused. His answer to every question is: I don’t know.

Harris Dickinson is very different. For a start, he’s not American but British and grew up in the east London suburb of Leytonstone. Dickinson. He is also most unlike his character: Frankie is confused and all over the place whereas Harris had certainty in his life from an early age. His friends and family, he tells me, always knew that he wanted to be an actor. “Everyone just knew that about me,” he says. “I was always messing around with a camera.”

Eventually, the messing around with cameras led to Harris making his own short film, Surface, in 2014, when he was just 18; three years later, he is now being seen as a potentially big star of the future. Next year he stars opposite Amandla Stenberg in the film version of dystopian book series Darkest Minds; and he's currently in Rome, filming FX’s 10-part TV series Trust, directed by Oscar winner Danny Boyle.

Beach Rats, which is Dickinson's first movie, proves that he is unafraid to take on challenging and difficult roles. When I speak to him, Harris says he was immediately drawn to Beach Rats. “I loved it straight away,” he says. “I felt the tone of it, I felt the pace. The character jumped off the page for me – I was feeling it as Frankie. It’s rare when something like that happens and it makes you really enthusiastic about the project. You want to be that character and you want to tell that story.”

The story is a difficult one. In the words of the writer and director Eliza Hittman, Frankie doesn’t really know where he’s headed or what he wants, but he does know what kind of behaviour is off-limits in the masculine culture he’s grown up in: the working-class neighbourhoods of South Brooklyn.

Hittman says she always wanted to write a story about those neighbourhoods, which she knew a little from her own youth. “It’s a part of Brooklyn that feels caught between past and present,” she says. “Those areas have a history of violence of all kinds – crimes against people of colour and gay men, and organised crime – and, unlike other parts of the city, change has come very slowly.” The aim of the film, says Hittman, was to explore the intense pressures on the young men who live in such areas, men forced to live traditionally masculine lives in an environment with no clear alternative, role models or way out.

For someone like Frankie, who is also beginning to wonder whether he might be gay, the only place where he can explore his attraction to other men is the internet, and that made for an extremely challenging acting part for Harris. Yet although Beach Rats depicts close up some of Frankie's sexual encounters with men, the young actor says he had no trepidations about the film’s sex scenes.

“Eliza had this conversation with me, reassuring me that every scene would be artfully done and justified. I wasn’t worried about any sleaziness, or about the film being a misrepresentation of sexuality or gender or anything,” he says. “At no point do you get distracted by these sex scenes. The way they shot it, the way they went about staging it … it was perfect, I think.”

Harris also believes that the film’s frankness about sex and sexuality serve a bigger purpose, which is to raise some important issues faced by young people, and their parents, especially safety online. In the film, the internet is the only place where Frankie can feel safe and express himself, but it is also the place that draws him into danger.

“It’s one of the great themes of the film,” says Harris, “the escapism associated with the modern age of social media and the form of comfort that people take from something that isn’t real. I think it’s extremely dangerous. We’ve become accustomed to the fact that young people feel that they can find comfort in this unreality or an expressed version of themselves that they’re not ready to show to society – they can express desires online or on their phone.”

However, as Beach Rats makes clear, this online world can go wrong – in Frankie’s case, he starts taking risks and hooking up with guys for real; for others, the comfort of the internet can turn to hate crime. Harris believes that all we can do is try to prepare and warn young people because the internet is here to stay. “We just have to accept it and prepare for it,” he says.

Harris also believes the film could help raise awareness about homophobia, and the fact that it has not gone away – far from it. In the US, gay people are more likely than any other minority to be the victims of hate crimes. And in the UK, the number of gay hate attacks has risen by nearly 80 per cent in the last four years – according to a report by Stonewall and YouGov in September, more than one in five LGBT people in Britain have experienced a hate crime or incident compared to 16 per cent in 2013.

Harris thinks part of the problem is the kind of masculine atmosphere in which young men like Frankie live. “There is still homophobia, especially among young men and male groups in traditional masculine areas,” he says. “There is this notion of masculinity that is perpetuated through their groups; they don’t understand it, and lack of understanding leads to hate.”

In the end, though – despite the bleak nature of Beach Rats and the horrible way in which Frankie’s situation ends – Harris can’t help but be optimistic. “I feel like the world is getting better generally,” he says. “It’s moving in a progressive direction and minds are widening. The world is changing, people are becoming more aware and it’s becoming more unacceptable to be homophobic. I hope people are realising how ridiculous it is.”

Beach Rats (15) is in cinemas from Friday, November 24