They don't mean to be rude to the girls, but they just want to have fun and probably make friends (if everything goes well). They try to get the girls' attention by using some funny and interesting words/phrases in a humorous way.
not a teacher
I take the gist of the OP's question to be: "What phrases or words do we use to describe boys approaching girls (or vice versa) in a friendly way and trying to make their acquaintance with humorous and clever talk". In my opinion this would serve as a good definition of "to chat up" in many situations.
As I say, this may be a regional thing.
Also, although it often implies an ulterior motive of some sort, I don't agree that "chat up" needs to always suggest a romantic intention.
There are several definitions and examples online that indicate broader usages that I'm familiar with.
Dictionary.com:
2) to talk to in a friendly, open way.
Engage in light, friendly talk, as in, "He was soon chatting up all the board members".
Collinsdictionary.com
2) to talk persuasively to (a person), esp. with an ulterior motive.
"And whenever he is on the road, he takes some time out to chat up local journalists".
Vocabulary.com quotes Slate (Feb. 2013):"Instead, bored kids waiting in line for a Little Mermaid ride will get chatted up by an animatronic seagull".
…etc.