As noted in the comments by Leebo, Eddie Kal, and A. Ellett, the に marks the agent of actions in certain constructions. We sometimes use by in English in a similar fashion.
In the ～てもらう construction, consider that the agent of the verb もらう is getting (もらう) something done (the ～て verb) for them. This is, in some ways, not far from the passive, where に is also used to mark the agent (the doer of the action) and は or が to mark the patient (the receiver of the action).
We might express this in English as:
- I was taught by the teacher
- I got taught by the teacher
Note: In English, the two are so close that they are essentially fusing in modern colloquial usage. The "getting" sense of "receiving" is thus often expressed in a slightly wordier fashion, to avoid ambiguity:
- "Getting" with explicit "receiving":
- I got the teacher to teach me
The key point to remember for ～てもらう constructions is that they are similar to the passive, and the agent (doer) of the ～て verb generally takes に.