A VLAN (virtual local area network) splits one physical network into several separate ones in software. The devices share the same cables and the same switch, but each group behaves as if it had a network of its own, and traffic only crosses between groups where you allow it.
The problem with one flat network
A small office often starts with every device plugged into one switch: laptops, printers, the file server and the Wi-Fi access point for visitors. That is one local area network (LAN), and every device on it is in the same broadcast domain.
A broadcast is a frame sent to everyone at once. Devices broadcast all the time as part of normal work: ARP asks 'who has this IP address?', DHCP asks 'can someone give me an address?', and discovery protocols announce printers and media players. Every device on the LAN receives every one of these frames and has to look at it.
With ten devices that is fine. With a few hundred it becomes noise: bandwidth and processing time spent on frames meant for someone else. The bigger problem is trust. On a flat network a visitor's phone sits next to the payroll server, and a compromised laptop can talk directly to everything else.
The old fix was physical: a separate switch and separate cabling for each group. VLANs do the same job without new hardware.
What a VLAN is
A VLAN is a group of switch ports that the switch treats as its own network. Each VLAN has a number, the VLAN ID, and the switch only forwards a frame between ports in the same VLAN. Broadcasts stay inside the VLAN they started in.
So one 48-port switch can act like three smaller switches: ports 1-20 for office staff, 21-30 for servers, 31-48 for guests. The cables stay as they were. The split is logical, set in the switch's configuration, not physical.
Each VLAN is its own broadcast domain, and in practice each one gets its own IP subnet too. Devices in VLAN 10 might use 10.0.10.0/24 and devices in VLAN 20 10.0.20.0/24. That matters later, when traffic needs to cross between them.
Access ports and trunk ports
Wondering how this was made? How we make these