The letter 'פ can make both sounds, it depends on its nikkud (if there's a dagesh: פּ - the dot in the middle - then p, otherwise f). Without nikkud, there is no way to know, you just have to memorize when it's 'p' and when 'f'.
That said, there's one easy rule that might be good to remember: in all non-foreign words if 'פ is the first letter it makes a 'p' sound; and if it's at the end of the word (written like ף) it makes a 'f' sound.
I could imagine its the yiddish word for peach, because peach is pfirsich in german. I think it makes more sense when modern hebrew was invented, to use hebrew words and for the things where there were no ancient hebrew words they used yiddish because it was already the same script
When Zionists creates modern Hebrew, they used many sources, but I believe Yiddish was not one of them - Yiddish is exactly what they wanted to abolish! They much preferred more ancient sources.
Specifically אפרסק resembles the fruit name in many languages ("peach" also comes from the same); it started (according to https://www.haaretz.co.il/magazine/the-edge/mehasafa/.premium-1.4383383) from the Romans calling it "Persian apple". The form אפרסק, according to the same article, dates back to the Mishna.
It has two phonetic uses. One is a glottal stop, the other is a vowel marker, usually /a/ and very rarely /o/. But it's understandable why it seems so arbitrary: most Hebrew speakers, most of the times, don't do the glottal stop; and most /a/ sounds in Hebrew are not marked with any letter. So there is rhyme and reason to why א appears where it does, it's more historical explanations corresponding to current phonetics.