I also struggle with all of these kinds of strange inconsistencies in Pinyin.
Your Chinese friends have trouble explaining it because they learned speaking before they learned Pinyin and Pinyin seems to have been designed to make sense that way at the cost of confusing adult second language learners.
With many languages such as English the writing is based on the idea of having certain letters for certain sounds, wherever they occur in a word. And because Pinyin uses our alphabet we expect it to work that way.
But in Chinese there's a different tradition based on syllables. Each syllable has a beginning sound and a final sound, also a medial sound. Some of these are optional so don't occur in every syllable.
Now there is actually greater variety in the sounds of these initials and finals, the sounds written with the same letters are often not quite the same, but they didn't want to have to use too many letters so decisions were made about which sounds would use the same letter and which would use different letters. There as more than one way to decide these things (linguists analyse the Chinese sounds typically three different ways), but Pinyin chose one of them.
For a native speaker all these sounds and combinations are already known and they just have to learn which letters to use for them.
But for a nonnative who is already used to the Latin alphabet from their native language we expect certain letters to each have one sound all the time, but in Chinese they actually don't.
This also explains a lot of bad foreigner pronunciations from people who learned Chinese with too much reading in pinyin and too little speaking with natives.
The best way to deal with it is to learn all the initial sounds, all the final sounds, and all the syllables made from them. But there a lot of them to learn! Way more than just learning the Pinyin letters, so it takes time and you first have to free your mind from your expectation of alphabetic spelling.
(And of course English spelling is nothing like one letter for one sound either. I suppose it might be harder for people who know a language with much more phonetic spelling to learn Chinese Pinyin.)