"This is an onion."
Translation:Das ist eine Zwiebel.
"dies" would be possible, but very formal.
If you want to emphasise that "this is an onion, not that" (or just to add random emphasis), you can say, "Das hier ist eine Zwiebel."
"Diese ist eine Zwiebel" doesn't work for this purpose. (It would work for "Cinderella fährt in einer Kutsche. Diese (= die Kutsche) ist eine Zwiebel." "Cinderella rides in a carriage. The carriage (literally: 'this one') is an onion.")
why in this case it's just "dies" whereas in others with the masculine or neutral gender one uses "dieser" and "dieses"?
"dies" = "this [here/there]" is like pointing a finger at something and address the whole [collection of] thing[s] as "this".
"Dies ist eine Zwiebel." = The thing I'm holding is called an onion.
"He only scored 45%. Dies bedeutet, dass er die Prüfung nicht bestanden hat." = This fact means that he didn't pass the exam.
"She said she had paid for the books. Dies lässt sich nicht mehr nachprüfen." = What she claims to have happened cannot be checked/verified anymore.
Note that in the last two examples, "dies" doesn't refer to an object but to the whole statement that came before.
"diese(r/s), pl. diese" specifically refers back to an object (or several, if plural) mentioned before, as in the Cinderella example, and takes the same number and gender:
"Cinderella fährt in einer Kutsche (f.). Diese (f.) sieht aus wie eine Zwiebel." = The carriage I mentioned earlier looks like an onion.
"Der Wecker benötigt zwei AAA-Batterien (pl.). Diese (pl.) müssen separat erworben werden." = "The alarm clock needs two AAA batteries. These need to be bought separately."
It might also help to look at how you ask after "dies" and "diese(r/s)":
Was ist schön? Dies (or: das [hier]) ist schön. - What is lovely? This is.
Welche(r/s) ist/sind schön? Diese(r/s) ist/sind schön. - Which one(s) is/are lovely? This one is. / These are.