CBN is essentially degraded THC. Just as decarboxylation converts THCA to THC, by removing the Co2 molecule, THC will then oxidise or degrade to CBN, as it loses its hydrogen component. Both decarboxylation and oxidisation occur as a result of heat and time,

though oxidisation is also caused by excessive exposure to sunlight and oxygen.
CBN can be created from THC through oxidisation, or from CBNA via decarboxylation. Generally decarboxylation occurs before oxidisation, but not always. So the two routes to CBN from THCA can be either THCA converting to THC (through decarboxylation) and then THC converting/degrading to CBN (through oxidisation) or alternatively THCA can degrade to CBNA (through oxidisation) and then converting to CBN (through decarboxylation).
Though THC is usually considered the only psychoactive cannabinoid in cannabis, with THCV essentially deemed as the "varin" version of THC, CBN does also have mild psychoactive effects, though such effects do not last as long as with THC and are considerably weaker than THC.
Like THC, CBN has affinity with both the CB1 and CB2 receptors but is much weaker than THC. Unlike THC, CBN is only a very weak agonist of CB1, though does retain a relatively good affinity with CB2.
The weak reaction with CB1 is considered the reason for its sedative effects and while CBN is not overly desirable for most medicinal applications as it is generally considered weaker than THC for most effects, and is not overly desirable for recreational uses as the psychoactive effects are considerably weaker than THC.
Despite the weaker affinity with cannabinoid receptors CBN is gaining more recent attention for medical applications. In addition to being a very effective sedative, CBN has also demonstrated good analgesic (pain relieving) effects, anti inflammatory effects and anti bacterial properties. It may also have some anti cancer effects but this has not been well established.

A recent study demonstrated strong anti bacterial activity against MRSA

Because CBN retains a reasonably good affinity with CB2 receptors it may still have good applications as part of cancer treatments by stimulating apoptosis through the CB2 receptor.

CBN remains comparatively understudied compared to other cannabinoids, which have all had research hindered by legal barriers, but is gaining attention specifically for its anti bacterial properties, specifically for MRSA, and is considered the best cannabinoid for aiding sleep.