It is somewhat philosophical(at least to me).
The question is as above. What is the 'substance' referred to as by the word set or class? Especially how is the thing called class defined? I cannot get a satisfactory answer from usual textbooks..So I ask here
There are many different approaches to how objects like a set might be constructed (and indeed thought of philosophically), and this also has a lot to do with your choice of axioms.
One perspective I particularly enjoy is the constructivist one. It doesn't allow for the full range of objects present in classical mathematics but it grounds a great many of them with a nice computational interpretation. We can construct sets (or, things that are isomorphic to everything else that we would ever call a set) in a number of ways, such as physical data on a computer using something like the calculus of inductive constructions, by building them out of types. If you're interested in foundations of mathematics, I can strongly recommend trying to pick up some type theory -- you could have a look at how an automated theorem proving language like Leanprover or Coq operate and I think that line of inquiry might clear some things up for you (or raise additional, but more precise questions!).
On the other hand, some take a view of platonic idealism and I do not honestly know enough about this perspective to give it the credit it deserves, but where mathematical objects are thought to sort of exist in an a priori way outside of the physical world.
Unfortunately, this question is perhaps a little too vague for anybody to give any really substantial answer to as is.