Is "my" really necessary in this sentence : " When I was (in third year,in MY third year) at the university" .If it is then why do we need to use 'my'?
The question is "Can I refer to a specific thing without using a determiner?" And the answer must be No: a determiner is always necessary to specify the thing referred to. There's a clue in the very name determiner: that which determines.
Thus, to answer your specific question, if you want to refer to a specific "third year" — yours as opposed to anyone else's — you need a determiner like my or possibly the.
You can use either, the meanings being slightly different.
in third year at University
Here we are giving a name to that year, "third year" is, obviously, the third year of studies. It is equivalent to the American "in junior year at University." The specific period is being named.
in my third year at University
This means the third year you have spent there.
Let's say you were a poor student and failed your examinations, but had lots of money. You tried to pass the first year of courses twice and were studying again to give it a third try. Here you would be in "first year" or "freshman year" at the University even though you are in "your third year".