Wayne Scarratt is accused of raping the girl and punching and stamping on her head during the alleged attack, which happened in secluded woodland near Walsall at around 6pm on August 7 last year.
But giving evidence at Stafford Crown Court, Scarratt said he believed she was 18 from the picture she had posted online where they befriended each other before later meeting up and having consensual intercourse.
Scarratt travelled from the address where he was living in Malvern to meet her in despite the court hearing the girl had verbally told him she was only 15.
They met in a secluded area where they laughed and joked and he agreed to buy her a vape and purchase a smartphone off her.
He told the court they later on they moved to a nearby location after being disturbed by a dog walker, where they eventually had sex.
Questioned by defence solicitor Dafydd Roberts, Scarratt said he believed all the time from her images and conversations they had that she was 18.
The court heard he had befriended the girl on Instagram and Snapchat earlier on August 7 and they had agreed to meet up later that day. Scarratt travelling by train from Birmingham and taxi from Walsall to the agreed point.
When he was arrested three days later on August 10, for leaving his agreed place of residence where he was living after two earlier offences of sexual activity, he denied they had intercourse.
But he said that was because he was scared of breaching the bail conditions, not because he felt guilty about meeting up with the girl, who he maintained he thought was 18 and was complicit in what happened between them.
Prosecuting, Maria Brannan said: "The girl told you with seven messages on Snapchat that she was only 15 and you knew you shouldn't even be talking to her.
"Yet the evidence shows you sent her messages of a suggestive nature, offered to buy her some cigarettes and a drink, and arranged to meet up, travelling a long distance in one day to do so."
The defendant maintained the image she had provided on their initial Snapchat conversation indicated she was 18 and that other conversations, which were not read out to the court, also led him to believe that was the fact.
Scarratt, of Orchid Court, in Malvern, denies rape, two counts of assault occasioning grievous bodily harm, common assault, theft, and breach of a sexual harm prevention order.
The case continues.