Can the US president reside somewhere else than the White House?
Yes, they can.
There are no requirements that the President must live in the White House. However, since the White House has command centres, it wouldn't be convenient for the President at all if they choose not to live there.
[...] is there a law that say president have to be there ?
No, there isn't such law.
The Compensation of the President states that:
He shall be entitled also to the use of the furniture and other effects belonging to the United States and kept in the Executive Residence at the White House.
(emphasise mine)
The keyword is 'entitled', so it's up to the President to decide if they want to live there. However, even if it's legal, it doesn't mean that it's feasible.