If you want to express what your teacher is talking about, the right way to say it is:
I found my key while I was looking for something else.
This isn't really incorrect:
I found my key while I had looked for something else.
The speaker here is saying that first he/she looked for something else, then stopped looking for that something else (gave up on it or found), but she did end up finding the key.
I found my key when i (had looked - was looking ) for something else.
The use of when is a bit weird.
By using when, you are saying that at the time the act of looking was in progress (was happening), or that the act of looking had completed (had happened), you found your key - but When also makes the two things it connects a bit disconnected or disjointed - implying it that the two are not strictly dependent on each other - i.e. maybe you accidentally found your key.