Many times when a character uses magic in anime, it sure looks like there's a Star of David being used. Why does anime use this symbol so frequently? On some level, this trend could be seen as comparable Jewish and Christian symbolism in Neon Genesis Evangelion, where symbols foreign to Japanese viewers were picked at least on some level because they seemed "cool" and "exotic." However, this particular symbolism does often have some relevant meaning when looking at difficult occultic traditions, both Western and Eastern.
The Star of David wasn't always used exclusively by the Jewish community. It can be seen in medieval church architecture all across Europe. The Star of David wasn't adopted as the de-facto symbol of the Jewish community as a whole until the 1800s. During the Middle Ages, Kabbalists (Jewish mystics) began using it in their practices due to its significance with King David. The Star acts as a shield of God for those who use it. It could be for this reason that many anime use it when magic is involved.
There are also more close-to-home reasons why anime and anime use the symbol. The hexagram is found on the cover of The Tibetan Book of the Dead, a Tibetan Buddhist book that describes what a soul will go through in the periods after death and before reincarnation. In Shintoism, there is also the Kagome crest (no, not that Kagome), which appears in both six-pointed and eight-pointed forms. It represents the balance of opposites, similar to the yin and yang symbology, and dates back to the 5th century BCE. Buddhism and Shintoism are Japan's primary religious traditions, so it could be that when artists are creating a magic system for their series, they might decide to use a symbol that many viewers and readers will recognize.
A third possible reason is the hexagram's ties to King Solomon, who used magic bestowed by God to command a legion of demons to build a temple. The Seal of Solomon is found in both Jewish and Islamic traditions. It can also be depicted with pentagrams rather than a hexagram and is used to summon and control spirits. This type of magic originates from a publication known as The Keys of Solomon, particularly in a portion known as the Goetia or The Lesser Key of Solomon. This particular text instructs the reader through a ritual that will summon one of 72 great demons of Hell and how to control the demon to abide by the summoner's wishes. These demons include Beelzebub, Lucifer, Leviathan, Lilith and Paimon. Because of its association with magic and summoning, it's easy to see why some anime would want to include the hexagram in their magical system.
One of the most well-known examples of this symbolism in anime and manga is Fullmetal Alchemist. The Homunculi's seal features a hexagram in the middle of an ouroboros (a serpent eating its own tail). The ouroboros can be traced back to Ancient Egypt, appearing on tomb walls. It represents the balance between life and death in alchemy, while the hexagram represents a balance of the elements, but also represents human creation. Thus combining the two means that all aspects of creation are in balance. Ed and Al's transmutation circles also feature slight variations of the hexagram.
Notably, the Homunculi seal design was changed from a straightforward Star of David-esque hexagram in the manga to a slightly altered design in the anime. As anime is an increasingly international market, there is a growing sensitivity to how international viewers may perceive symbols in anime. It's possible the design changes between the manga and the anime were an attempt to avoid any confusion that might have been caused seeing what's widely considered a Jewish symbol on the Homunculi. The Yu-Gi-Oh! card "Spellbinding Circle" had to replace its original hexagram image with a more abstract design when brought to the States for this reason.
Another manga usage of the Star of David is in the Pactio circle in Negima. Usually, it appears on the ground when a Pactio contract is being made, and then again on the card representing that contract, where it appears behind the person the magi has made the contract with. This contract allows the Magister to temporarily grant their power to their contract partner for a short amount of time. It also allows the partner, the Ministra, to summon a magical artifact that takes on the form of some aspect of that person's personality. The cards also allow the Magister to summon the Ministra, which would align with the King Solomon aspect of the hexagram.
There are many different reasons the Star of David appears so frequently in anime magic. Since there are many different magical systems that use the hexagram, any of them could be the inspiration. Such imagery appears less frequently in anime now to avoid confusion, but when you encounter such imagery when watching an older series, keep in mind that, in most cases, its usage probably doesn't actually have anything to do with Judaism in particular.