Nielsen studied philology and took a linguistic-historical degree in 1865. In 1880, he completed his philosophical doctorate thesis on the council Riksrådet.
Nielsen descended on both father"s and mother"s side from the established civil and commercial bourgeoisie. After three years as a teacher at Nissens Latin School (interrupted by several rounds of archival studies in Sweden and Denmark), he was employed in the National Archival Services of Norway (Arkivverket) from 1869 to 1978 and at the same time served as librarian at the Deichman Library. He was appointed manager of the University"s Ethnographic Museum in 1877, and the following year he became research fellow in history and geography.
Nielsen was an important advisor in Norway to King Oscar II of Sweden and Norway.
He had close connections to the Royal Family, and was the tutor of the Swedish princes Oscar and Eugen during their stay at the University of Christiania in the 1880s. Nielsen was chairman of the Norwegian Historical Association, and edited the journal Historisk Tidsskrift from 1903 to 1912.
Together with Ludvig Ludvigsen Daae he co-edited the journal Vidar 1887-1889. In 1879 he released the travel guide Reisehaandbog over Norge, popularly called Yngvar, which appeared in 12 editions until 1915 and came to play an important role in the spread of tourism.
His guide books were published in English and German.
Probably Nielsen"s most important work as an historian was Lensgreve Johan Caspar Herman Wedel Jarlsberg (three volumes, 1901–1902), his biography of Johan Caspar Herman Wedel-Jarlsberg (1779–1840). Wedel-Jarlsberg played an active role in the Norwegian Constituent Assembly at Eidsvoll in 1814 and was the first native Norwegian to hold the post of Governor of Norway during the union with Sweden.
Norwegian Academy of Science and Letters]
Nielsen was a board member of the Norwegian Trekking Association from 1879 and Chairman 1890–1908.