Hard immovable painless occipital lymph node no bigger than 0.5 cm, noticed 5 weeks ago. Can this be cancerous?

Not really. 0.5 cm nodal lesion is about 1/4 inch. Most of the pathologic lymph nodes don't appear in the occipital region which drains the back of the scalp. they appear along the jugular chain usually not as a single small nodule. This could be lipoma, fibroma, neuroma. If it enlarges and is very firm, then a bx would be performed. Otherwise warm soaks to the area could resolve the problem.