Using ≪Style≫ Tags in the ≪Body≫ With Other Html

How style tag is working inside body tag?

Because style contains style information for a document, or part of a document. so no matter where you have the h1 (in this case), although you shouldn't have inside head because it is invalid HTML , it will be styled. check more info here

The <style> element can be included inside the <head> or <body> of the
document, and the styles will still be applied, however it is
recommended that you include your styles in the <head> for
organizational purposes — it is a lot better to separate your content
from your presentation as much as possible. Even better, put your
styles in external stylesheets and apply them using <link> elements.

How can I insert CSS styles inside body independent of specific elements?

Under the premise, you don't care about invalid HTML in relation of <style> inside <body> (which is not that uncommon), you can assign unique identifier i.e.:

<style>
.my-class-1 {
color: gold;
}
</style>
<div class="my-class-1">Fragment Content</div>

<style>
.my-class-2 {
color: tomato;
}
</style>
<div class="my-class-2">Fragment Content</div>

<div class="my-fragment-1">
<style>
.my-fragment-1 .my-class {
color: teal;
}
</style>
<div class="my-class">Fragment Content</div>
</div>

<div class="my-fragment-2">
<style>
.my-fragment-2 .my-class {
color: hotpink;
}
</style>
<div class="my-class">Fragment Content</div>
</div>

<style id="my-style-1">
#my-style-1 + div {
color: orangered;
}
</style>
<div>Fragment Content</div>

<style id="my-style-2">
#my-style-2 + div {
color: indigo;
}
</style>
<div>Fragment Content</div>

style tag within body and W3 Standards

From the front page of the document you linked to:

This document has been discontinued and is only made available for historical purposes. For an up to date reference on HTML elements (and more) please consult Web Platform Docs.

Some draft versions of HTML 5 allowed style elements in the body under certain conditions.

There were various problems with the design of that functionality and it did not make it into the final version of HTML 5.

Is safe to put html style tag into body tags coding html emails?

It seems client dependent. Check out a similar answer here.

Some clients will support the use of styling in the body, but generally not in the head. Since there is really no way to incorporate css, it makes sense that this would be the case.

HTML 5 body tag to change color

I suggest you do some research about basic css.

You can achieve that with this.