I know that ontology is a sub-field of metaphysics. But I can't see the difference between them. I mean ontology is defined as "The study of being and existence", and metaphysics is defined as "fundamental nature of being and the world"; is there a difference between these two definitions?
This is an excellent question, and deserves more discussion than I can really provide here, but I'll try to give a simple and clear delineation between the two fields.
Metaphysics is a very broad field, and metaphysicians attempt to answer questions about how the world is. Ontology is a related sub-field, partially within metaphysics, that answers questions of what things exist in the world. An ontology posits which entities exist in the world. So, while a metaphysics may include an implicit ontology (which means, how your theory describes the world may imply specific things in the world), they are not necessary the same field of study.
Let's consider an example that might clarify the distinction a little more: gravity. Gravity is certainly not an object, but I assume that physics would be in a pretty bad spot if we say that gravity isn't real. So what should we make of gravity? Well, we roughly know that gravity is a physical law that affects matter.
So, a metaphysical conclusion we can draw from this is:
"The world is such that matter is governed by physical laws."
This is a metaphysical conclusion because it describes a way that realty is - laws are a property of reality (and further, reality is the kind of reality that can have laws). The distinct ontological conclusion to draw from our discussion so far is:
"There is a physical law of gravity."
This is ontological because it is about a posited entity - the entity that we call "the law of gravity". Now, where most people seem to get tripped up here is in the fact that our ontological conclusion is also a metaphysical conclusion; any posited entities are also part of (or describe) how the world may or may not be. But the ontological conclusion differs from the non-ontological metaphysical conclusion insofar as it may imply metaphysical conclusions, but is not itself about reality. "Meta" means roughly "about" or "after", and physics means physics, so metaphysics means "about (or after/beyond) reality". The ontological conclusion is about a given entity (or kind of entities).
I hope that helps!
generally covers topics such as cosmology (space and time), determinism and free will, mind and matter, ontology (being, existence, reality), necessity and possibility, identity and change, among others.
is just one of those subtopics of metaphysics; it focuses on the categories of being and whether things can be said to exist or not.
The Wikipedia articles on Metaphysics and Ontology are not entirely clear but you can get an idea of the differences by looking over each. The SEP article on Metaphysics (and ontology) is more in-depth and I would definitely recommend it if you want a thorough overview, especially since someone seems to want to vandalize the Wikipedia Ontology page...
Your confusion is justly warranted because metaphysics turns out to be a very broad field and is somewhat difficult to define (if at all possible). Traditionally metaphysics has been divided into two parts: special metaphysics and general metaphysics. Ontology was included under the umbrella of general metaphysics, which traces its roots back to Aristotle, and can be thought of what comes after- physics, the things beyond the physical. (The Greek word for "after" is "meta"). But things included under the umbrella of special metaphysics came historically after general metaphysics and includes the possibility of free will, the nature of identity, the existence of God, etc.
So in short, ontology is a sub-field of metaphysics. Ontology is the study of being, and is a little more specific and narrow than metaphysics in general which is the study of the general nature of reality, and this includes other questions more broad and fundamental than those of ontology alone. You might find this link helpful: Metaphysics or Ontology?
Perhaps we should really find out when metaphysics started as a discipline distinct from other disciplines, and by discipline I understand a study by man of things whatsoever at any time in any environment under any aspect whether real or unreal or purely fictional, possible or impossible or even endowed with contradictory features whatever, in objective reality or merely in the mind of man.
On that basis I would say that metaphysics acquired a specific distinction from all other disciplines when man notices that there is a difference between something and nothing, and seeks to draw up the features of something by which something is different from nothing.
At this point I would imagine ontology came about as a distinct study of mankind separate from metaphysics, because it is concerned with the kinds of something which something is already no longer nothing.
But in actual usage the two terms are used inter-changeably.
For example with atheist cosmologists, they want to understand nothing as something, but it is their ruse in order to tell common atheists who do not think deeply: that the universe came forth from nothing: so, no God is needed.
In that respect they are already into a wrong metaphysics and a wrong ontology, and man cannot draw that conclusion of their being wrong, unless he is cognizant of what is metaphysics and ontology and what is any other study of man distinct from metaphysics and ontology, and also the distinction between metaphysics and ontology.
Now, with theist cosmologists, the correct metaphysics is that there has always been something even before the varieties of something came to the notice of man; and the always something is God, the only self-existing something that is in effect the unique uncreated creator and operator of the created universe,in His fundamental relation to the universe that is studied by scientists or more in particular material scientists.
That is why atheist thinkers do not go for metaphysics and ontology and all kinds of philosophy, they just keep on insisting that material things are the only somethings to study for man.
But even the science of physics which is a material investigation of the ultimate particles and origin of the (material) universe is today cognizant of the fact that the material universe has a beginning 13.7 billion years ago.