I don't know of anything that specifically addresses the money collection--Bob Gale and Neil Canton don't talk about it in the DVD commentary for that scene, and the usually-pretty-complete Futurepedia doesn't give details about where Doc got it in the money entry--but since Doc was implied to be pretty well-off in 1985, he could have either just bought old bills from collectors without needing to do any extra time-traveling, or perhaps he bought something valuable in all times like gold and then jumped to different times to exchange it for cash.
Although thinking about this, it seems like there is some circumstantial evidence that he didn't actually time travel to each period to get the money--in part II when Doc was talking about destroying the time machine as they were about to leave 2015, he said "My only regret is that I will never get a chance to visit my favorite historical era--the Old West", indicating he hadn't yet visited that period despite having bills from 1861, 1863, 1864 and 1875.
I suppose he could have visited the 1800s in a different geographical region than the Old West, but you'd think if he was in the era he would have made a visit, not to mention the DeLorean always took you to the same place on Earth in a different time, and in all their onscreen adventures we saw them remain in the California area.
As for why I say Doc was well-off in 1985, and what the in-universe explanation for that is, writer Bob Gale suggests in this MTV interview that Doc got a bunch of money (presumably to fund his experiments, not to mention buying a DeLorean) by burning down the family mansion he had been living in in 1955 and getting the insurance money.
From the interview:
The opening shot, when the camera is going through Doc's laboratory,
there's a newspaper on the wall that says the Brown mansion was
destroyed in a fire. You can infer from that that maybe Doc set his
house on fire to collect the insurance money.
And if you look at the newspaper clipping in the opening shot, there's also another one next to it saying "Brown Estate Sold To Developers: Bankrupt Inventor Sells Off 135 Prime Acres", so whether or not the insurance thing is true, there's evidence in the film he made a large sum by selling the land.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/KTweX.jpg)
(people say online that this newspaper says the mansion burned in 1962, though it isn't visible in this screenshot)