The Gold can be obtained in many ways. There is Gold in the Chests. The amount of the Gold one Chest contains depends on its type. The rarer the Chest, the more Gold you get. If your main method for obtaining Gold is from Chests, you cannot afford to miss any free Chest, since it is available every four hours.
You can also get Gold from donating cards. For every donated common card, you get 5 Gold, and for every donated rare card you get 50 Gold. If you do your math, donating card can be profitable for you. Since every common card costs 3 Gold in the shop, and every rare card costs 40 Gold, if you donate one common and one rare card you will get 12 Gold profit.
The third method is the easiest one if you have some spare Gems. You can purchase the Gold from the shop in exchange of Gems. For 60 Gems you can buy 1000 Gold or a pouch. For 500 Gems you can buy 10.000 Gold or a bucket. And finally, for 4500 Gems you can purchase 100.000 pieces or a wagon of Gold.
The Gold is used for upgrading cards. The amount of Gold needed for upgrading depends on the level of the card. Fun fact, when you reach the highest level, you will need around 250.000 Gold to upgrade a Legendary card. There is also limit to the Gold a player can have and it is 500.000 pieces of Gold. So no, you cannot become millionaire in Clash Royale. The Gold is also used for starting a Glan and it will cost you 1000 pieces.