I guess that has been explained on previous messages.
first of all O is displaying the data given from your devices, not magic, just communication of data among instruments.
The Heading is the data given by a "heading Device", e.g. Fluxometer,
compass with interface device, gyro
compass, etc.
Being fluxometer and compass should be calibrated (compass adjustment either seaman way "adjusted") or at least compared, I mean if you are not certified to adjust your compas you can compare the true course with the magnetic one knowing the deviation at each course.
adjustment should be carried out by a official compass adjuster and sometimes is not
cheap at all.
most of the worldwide
flags don't accept the adjustment done by yourself if not certified. Of course there is another ones that accept it.
gyro compass is the most trustable way of getting the heading because is based in the true north, it must be calibrated with the latitude and also the speed, but most of these input are feed by GNSS, having all these data automatically corrected,
installation uses to be big and expensive and must required annual
maintenance by
service engineer.
about the COG is "graphically" calculated by GNSS considering actual and past positions so is really good source of how vessel is moving over ther earth.
could be consider as source for comparing with the magnetic course and calculate deviations.
but sometimes it get to confusion because small deviations in the positioning could lead in "big alterations" of course giving as not really a true picture of the vessel's track.
much better to make some kind of filter in positioning for this calculation not at every second and doing it on a "longer" period which give us much clear picture of the track.
from your picture you have to understand more or less that you're moving across the COG, maybe you can check it much better saving the track and you'll see that vessel has been in the past COG track instead of the heading track.
Also you have to consider that IMO recommends to use as RADARs input data the Heading and the STW and doesn't recommend to use COG & SOG.