I never understood this, though, because never even with old rotary phones, did we need to position our hand with our pinky and thumb like that
More seriously, people picking up the receiver of a Western Electric Model 500 would grip the receiver tightly; extending your thumb and pinky from this grip gets you the "pretend phone" hand mime. Otherwise it just looks like you're holding your fist to your ear. People grip a cellphone quite differently, generally with their fingerpads or the middles of their fingers.
It is common to cartoons and TV shows so some people will have learned it from there, but I'd guess the mine predates those shows. Maybe it when predates TV being common in people's homes.
Or sexual depending on the angle and tightness of fist.