When you complete a task material sometimes drops. When you complete a yield on a resource tile material may drop. The more troops you use, the longer they remain on the tile and, to some extent, the higher the tier of the tile, gives a better chance for a drop. Although leaving large numbers of troops on resource tiles for long periods entails risk. Also when you hit Invaders with your hero material drops.
The other source mentioned are the invaders, you will mostly get one random item per attack,some more useful than others.
The invader materials give higher bonuses, but you need to be at least Hero 30 to wear some of them,and 50 for all of them.
In order to attack invaders you need considerable amounts of energy,even if you can make quick progess in the game,by upgrading invader knowledge, and hero experience the amount of "free daily energy" the game gives you is quite sparce.
The received wisdom is that your first medium term aim should be acquiring gear which makes your hero more effective hitting invaders. To do that you seek to attack Royal Guardsman invaders whenever they are on the map.
There is quite a bit of material on the web to suggest that the way to go is to save up the material until you are in a position to craft epic or legendary equipment. That may be good advice if you are going to spend a lot of money advancing rapidly. If you are content to spend little or nothing and to advance by the sweat of your brow and grinding the advice is bad. Aim to make your first Royal Guardsman gear as soon as you can and later aim to replace that with, say, green level gear. After that start saving up for purple or gold. That approach is a bit costly in silver as it costs the same in silver to make low level equipment as top level. But it is a very long haul to gather enough material to make purple or gold gear - many months of play if you do not spend money. You need to be as efficient as you can be during that time. And it is more fun.