As per the Dharmgranthas, Lord shani dev is the son of Chhaya who was the second wife of Lord Surya. It is to be remembered that Chhaya is a very devoted devotee of Lord Shiv.
During Shani was inside the womb of Chhaya, she used deeply worship lord shiva daily by praying and performing rituals. Due to these activities, she didn’t take much care about herself. It directly reflected in the health of her and child in the womb.
This particular penance also reflected on baby Shani that the natural complexion of baby in birth became very dark. On birth, the child’s father was surprised and shocked to see his son in dark complexion.
It is to be observed that Lord Surya doubted on Chhaya and it hurt her a lot. It is to be remembered that Lord Surya is known for his brightness and darkness or black color is just the opposite of his features. He abused chhaya very strongly with harsh words and repeated that he couldn’t have such a son through her. He strongly reject the son born through her and didn’t take care of him.
In this manner Shani dev became the number one enemy to Lord Surya that is his own father. On the other hand, Shani dev strongly prayed to Lord Shiva so that he can become more powerful like his father and able to take direct revenge on this issue. Lord Shiva became happy with the devotion showed by Shani and wholeheartedly granted him all the powers in this world.