This is what I was told but the infinitive/any form of учить does not have any gender (as far as I am aware).

Maybe another example that has stumped me will give a clue;

это мне подарила моя бабушка, когда мне было десять лет.

Despite that being the wierdest structured sentance ever, I understand the way that the dative is used when age is involved, but yet again no idea why nuetral было is being used.