The OED specifically traces the term "dirty money" to a source over a century old:
dirty money (n.)
1897 S. Webb & B. Webb Industr. Democracy I. 313 When any class of work involves special unpleasantness or injury to clothing,
‘black money’ or ‘dirty money’ is sometimes stipulated for.
1960 Sunday Express 14 Aug. 1/1, 1,100 dockers‥are claiming ‘dirty money’ for handling a cargo of red oxide.
Yet for some time, dirty has been applied to more than our dirty socks, or a muddy shirt. Dirty has been used to convey sullied, tainted, impure, corrupt, illicit, immoral, etc.
The OED lists such nuances among its several meanings for dirty:
2a. Morally unclean or impure; ‘smutty’. Spec. dirty book, a
pornographic book; so dirty bookshop; dirty joke, dirty story, a
‘smutty’ joke or story; dirty weekend, a sexually illicit weekend.
2b. That stains the honour of the persons engaged; dishonourably
sordid, base, mean, or corrupt; despicable.
1764 Pulteney in Beatson Nav. & Mil. Mem. (1790) I. 26 Some Ministers‥cannot do their dirty work without them.
With that kind of heritage for the word dirty, it's not a long leap to apply the word dirty to ill-gotten funds.
As a side note, in addition to dirty money, the OED doesn't forget or neglect dirty pool, dirty words, dirty tricks, and dirty old men.