How did I get near-infinite magicka?
Solution 1:
The quest that gave you infinite magicka regeneration is Out of Balance
From the UESP site:
When cleaning the foci, a bugged two hour buff may be placed on you that increases magicka regeneration immensely. It is possible to get multiples of this buff during the quest. In the active effects category, it appears as "Fortify Magicka". Selecting it reveals it as "Drain Magicka, +25 Fortify Magicka for 2 hours". It doesn't appear to increase magicka capacity at all (as listed on the skills screen), but increases magicka regeneration rate instead.
Some players have reported that the buff remains much longer than the stated 2 hours. In this case, the buff(s) can be removed by opening the character editor with the "showracemenu" console command (on PC) and closing it again. This will also remove other temporary buffs, such as blessings, and enchanted apparel will need to be re-equipped to restore their effects. (v1.1.21.0 of game)
Solution 2:
This is potentially a bug in the Under Saarthal quest given to you by Tolfdir in the Mage College questline.
- Equipping the Saarthal Amulet can cause players to have infinite magicka.
Source: Skyrim Wikia
Hope that helps :)