Nielsen was born in Arendal, Aust-Agder. He was the son of Norwegian Telegraph Director, Carsten Tank Nielsen (1818–92) and Alvilde Olsen (1821–1890). Nielsen descended on both father's and mother's side from the established civil and commercial bourgeoisie. His grandfather, Jacob Nielsen, had been one of Christiania's largest lumber dealers and director of the National Bank.
Nielsen studied philology and took a linguistic-historical degree in 1865. 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. In 1880, he completed his philosophical doctorate thesis on the council Riksrådet.
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–89. Nielsen was a board member of the Norwegian Trekking Association from 1879 and Chairman 1890–1908. 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.
In October 1870, he married Karen Anne Juliane Hedvig Wedel-Jarlsberg (1847–1927), the daughter of Peder Anker Count Wedel-Jarlsberg (1909–1893). Nielsen was a member of the Norwegian Academy of Science and Letters from 1875 and the Royal Norwegian Society of Sciences and Letters from 1897. He received Reward Medal from King Oscar II in 1882, was knighted in the Order of St. Olav in 1894 and received the Commander Cross 1911. He was knighted by the Swedish Nordstjärneorden and owner of several other foreign orders.
- En Christianiensers Erindringer (1910)
- Under Oscar IIs Regjering (1912)
- Fra Johan Sverdrups Dage (1913)
- Da Unionen skulde briste (1915)
- Svendsen, Åsmund. "Yngvar Nielsen". In Helle, Knut. Norsk biografisk leksikon (in Norwegian). Oslo: Kunnskapsforlaget. Retrieved 23 May 2010.
- Storsveen, Odd Arvid. "Jacob Nielsen". In Helle, Knut. Norsk biografisk leksikon (in Norwegian). Oslo: Kunnskapsforlaget. Retrieved 23 May 2010.
- Rinde, Harald. "Carsten Tank Nielsen". In Helle, Knut. Norsk biografisk leksikon (in Norwegian). Oslo: Kunnskapsforlaget. Retrieved 23 May 2010.