A device can communicate directly with addresses on its own local subnet. When the destination is somewhere else, it needs a next hop. The default gateway is the route used when no more-specific route matches.
Home-network example
Your laptop might be 192.168.1.42/24 and the router 192.168.1.1. Traffic for another local device such as 192.168.1.50 can stay on the LAN. Traffic for an internet destination is sent to 192.168.1.1, which routes it onward.
Why it helps with router login?
On a normal home LAN, the default gateway is usually the router that controls the connection. Reading the gateway from the operating system therefore avoids guessing default addresses that may no longer apply.
More than one router
Complex networks can have multiple routers and static routes. “Default gateway” does not mean the only router; it means the next hop used when the routing table has no more specific path.
Routing decision
A device sends directly to same-subnet neighbors; destinations without a more-specific route go to the default gateway. On a simple home LAN the gateway is the router.
More than one route
VPNs, containers, virtual machines and enterprise networks can add routes that override the default for specific destinations. That is why an overlapping VPN can make a local router IP unreachable.
Gateway discovery is better than guessing
Reading the current gateway immediately accounts for changed factory defaults, mesh subnets and ISP installations.
Video walkthrough for What Is a Default Gateway? Why Your Computer Needs One
Visual foundation for network/host bits, masks, CIDR and subnetting. Use the calculator on this site for the exact arithmetic after understanding the concept.
Subnet Mask Explained — PowerCert Animated Videos. Watch on YouTube