The most common ways to earn gold in DnD 5e include completing quests, selling loot you take during your adventures, performing services during downtime, and finding hoards of treasure.
Quest givers of some means might offer a straightforward gold reward, while others might offer a boon or magic item.
Gems, artifacts, and unwanted magic items are high-priced, low-weight loot that commonly earns adventurers the biggest paydays for the least amount of hassle.
Selling your services in a town or big city, like selling healing magic or putting on a performance in a tavern, can also net you a small amount of gold during your party’s downtime.
And finally, some monsters (ahem, dragons) like to hoard lots of straight-up gold pieces in their lair, which can net your party a huge lump sum of gold. You might also get a big gold infusion from finding a forgotten vault or some other treasure lost to the sands of time.
For more unsavory characters, stealing and/or gambling can also be a way to make money during downtime. In the case of a major heist, this could be a significant quest in its own right (with a big reward).