NASB 1977 Deuteronomy 21:23
his corpse shall not hang all night on the tree, but you shall surely bury him on the same day (for he who is hanged is accursed of God), so that you do not defile your land which the LORD your God gives you as an inheritance.
That person is under a curse inflicted by God. This verse is fulfilled by Jesus on the cross.
Jesus who is hanged on the cross is accursed by God.
Galatians 3:13
Christ redeemed us from the curse of the law by becoming a curse for us, for it is written: "Cursed is everyone who is hung on a pole."
The law is a curse in the sense that it condemns us all to death. Jesus died on the cross becoming a curse for us. The law could not condemn Jesus. According to the law, he was not supposed to die. God made Jesus a curse for us by dying on the cross according to Deuteronomy 21:23. Jesus' sacrificial act undid the curse of the law for those who believe. Now, we are no longer under the curse of the law.