Why are some tags self-closing but others are not?

self closing tags are tags that don’t have a closing tag, it is void element and don’t need any closing tag, it is self defining and is itself enough to give an idea about the use of the element.
In self closing tags slash ‘/’ is optional in HTML5.
non closing tags list

VERY GOOD explanation with examples of only things that are covered till now. Thank you.

" Void elements like img and br cannot contain any content."

What does ‘void’ mean?

Essentially, void means empty. It means that these elements can only have attributes and cannot have content between the opening and closing tags. (Note that both <br> and <img> are self-closing tags though.) For example, the <br> tag can’t have any content because it’s just a line break, and the <img> tag can only have attributes like src and alt, not any actual content.