I thought gravity was a law.
You thought wrong. Newton had a law of gravity, but it is innaccurate. There is a modern theory of gravity.