Electro Crystal in Genshin Impact is used to create Insulation Potion and Shocking Essential Oil. Harvest them requires an elemental interaction, and you will need to hit the Electro Crystals with some Pyro energy to break them.
Going too close to an Electro Crystal will cause it to discharge Electro energy, doing a small amount of damage to you. Amber is perfect for farming these, as she can break them with her charged Pyro shot from her bow, and with no cooldown time you can easily farm any Electro Crystals in an area.
In Mondstadt, the best place to farm them is at Cape Oath. This area will spawn 4-6 Electro Crystals and will drop 1-2 resources each. There are also regular respawning chests in the area, and plenty of Iron Ore to farm as well.
The first place to check in Liyue is near the Oceanid boss at Wuwang Hill. There is a path way that move between two cliffs towards the boss, and it will be filled with Electro Crystal. You can also find Cor Lapis, Noctilicous Jade, and a regular Cicin Mage to farm as well, making it an excellent spot to visit every couple of days.
You can also find some Electro Crystal near the Statue of the Seven to the south of Mingyun Village. Jump off the side with the wooden bridge to drop down almost on top of them. There will be three here quite regularly, and if you drop down the cliff behind them you can find a Dendro chest that respawns too.