Hi,
I assume you are an EU-citizen (otherwise you will also need proper residence and work permit for being able to get dagpenge).
However as an EU-citizen the same requirements apply to you regarding right to dagpenge, as if you were a danish citizen.
The residence requirement you are referring to, will be removed from 1st February 2020, so it is no longer relevant that you have stayed 5 years in Denmark.
I understand that you already currently are member of an A-kasse and receiving dagpenge. You can keep your membership while studying in another country. You can change to a free study-membership.
You can not receive dagpenge while you are studying, but you can continue to receive dagpenge (from your current 2-year period with dagpenge) when you come back to Denmark, but only within a maximum period of 3 years from when you started to receive dagpenge, so this will be until March 2022.
Or you can earn a new 2-year period with dagpenge if you meet the requirements for graduates (based on your master).
However, as you can see in the requirements it is important that:
-You had a permanent address in Denmark no later than one day before the start of your education.
-You are in Denmark no later than 14 days (including weekends) after you end your education
But there is no requirement saying that the education must be completed in Denmark. So you can get dagpenge based on an education completed in another country.
However your master/education must be of a duration of at least 18 months for qualifying for dagpenge as an graduate.
I will recommend that you ask your A-kasse if the specific master you plan to participate in, will be enough for qualifying for dagpenge.
Best regards,
Anders Weber, www.a-kasser.dk