what does trademarks and copyrights contain. how similar can a name be to a name that already exists.
Unfortunately your question is too vague to answer in depth. Trademarks are governed based on laws that originate from countries, so what is legal in one country may not be legal in another. As a general rule, Trademarks cannot be copied. So if you want to name your game "Star Trek 2" for example, you will probably get a lawsuit. If you want to name an object in your game "Shields" then you are safe, even though Star Trek uses the same name, because "Shields" is a description based name and cannot be copyrighted, for the most part. To share an example, I use a Music Creation Utility Called "FL Studios". Before they changed their name, it used to be called "Fruity Loops". They were sued by Kellogg's because their cereal "Fruit Loops" is trade marked, and so they had to change the name to FL Studios.
Another example would be "Levi's" and "Wrangler". Both companies produce "Jeans" and both companies can use the term "Jeans" to describe their product, because it is a descriptive term that cannot be copyrighted. So if your spell is named "Fire Ball" or "Lightning Strike" multiple people can use it because it is description based. But if it is a specific name and not descriptive, you could be liable for using it.
we may not be the most suitable to answer. It would be best to go to a lawyer whose specialty is copyright.
But I will try to contribute my 2 cents to the subject, remembering how little I have been taught about Legislation, and Computer Legislation at the University.
Technically the copyright falls on the name of a trademark. And for this, they must be duly registered in the patent and / or copyright office that legislates and controls in each country. One can register any name as a trademark, as long as he can demonstrate that he will make an onerous use of it.
Now, going specifically in the area of computing and software, where things are abstract, there are certain things to consider. What one registers is the manifestation of an idea. And not the idea itself. It is true that there are places in the world where one can patent an idea. In fact, I would almost dare say that the USA is the only one. The USA patent and copyright and trademark system is one of the most disastrous and contrary to common sense. Examples of the ridiculous things you will find in the fight for the one who invented round edges on cell phones.
Pointing out in your case, and considering the legislative aspects of the USA, your concern is totally valid. But it is highly unlikely that a video game company will register the name of one of their spells to screw around and prevent others from using them.
Using Derrick's example, how is the company in question going to demonstrate that they were the inventors of the name for their spells? What other ways could a fireball be called? You cannot limit the action of an idea! If you want to put a fireball spell and other games do it too, that's fine. That some company appears now pretending to prevent others from using fireballs because they already have them ... it is nonsense.
Now, if it turns out that the spell's name properly has a highly distinguishable name, and that it is fully assimilated as part of the game's name trademark, the thing may have some legal complication.
Take as a case the "Windarmium Leviosá", from the world of Harry Potter. Take this spell outside, if it can conflict. Makes the entire package "Harry Poter"! And if you try to use it somewhere else, other than "Harry Poter something" it is quite likely that you will be accused of plagiarism.
On the other hand there are expressions that are already as common and current as "focus focus", or "Abra Cadabra" which do not fit copyrights. Mainly for 2 reasons: 1. are current expressions and that were acquired by popular use and custom. 2. The possible rights that may have been applied to it expired long ago.
One possibility you can evaluate is to consult the developers or the company, and they give you their permission. But first: consult a lawyer who works on the subject.