You can use Areas for that. Both Area2D and Area3D have properties to alter the gravity of nodes inside them. See space_override and the various gravity_... properties they have.
Alternatively, you could manually detect when the player enters the Area using their body_entered signal, and implement a custom gravity that way.