I am a US green card holder and working in Detroit, US. My partner is a foreign student in Windsor, Canada.
I am a citizen of Iran. Is it legal for me to reside in Canada and commute to US daily?
Technically this is possible. However in your case you are going to run into some difficulties.
The first difficulty is that you require a visa to live in Canada. A visitor visa is technically what you want, since it covers 'temporary residence'. (Technically your partner will be in Canada on a visitor visa, coupled with a 'study permit'.) Getting a visitor visa for one or two years is possible if you explain that you want to be with your partner.
The second difficulty is that if you live outside the US you are putting your US Permanent Residence status at risk. It depends on the length of time you will be living in Canada. Anything up to six months is probably OK, but more than that is a problem. There is a "Permanent Resident - In Commuter" status, which is for residents of Canada (or Mexico). You would need to convert your Green Card to that status, and be aware that it does not carry all the privileges of a full Green Card - particularly that time spent in Commuter status does not count towards citizenship requirements. You would probably need to get your Canadian visa before converting your US Green Card.
Assuming that both those difficulties are overcome there is nothing preventing you making daily border crossings. A fair number of Canadian and US citizens do this. A NEXUS card would absolutely help the process.
I would strongly recommend consulting lawyers with Canadian and US immigration experience before embarking on this. Alternatively you and your partner having separate residences, one in each country, and visiting each other on a frequent basis would be a simpler solution.
You may want to apply for NEXUS if you are eligible. This will let you use the NEXUS lanes which tend to move much more quickly and are usually less busy. It will also reduce the amount of screening to which you are subject, because you will be pre-screened during the application process.
Carefully research the border wait times at the times you intend to cross, to get a sense of the delays involved at the border crossings. These are the busiest crossings at the Canada/US border and delays can be significant at times.