VLANs essentially can split your network into several seperate isolated networks. The security comes in by forcing certain ports to be part of a specific vlan.
One example would be a seperate vlan for guests in conference rooms. They can have internet access but not see the company's computers and servers.
Another would be in a datacenter with multiple people's servers. You want them to see their own servers but not each others. And those servers are probably spread out through several racks making it harder to give them their own router and switch and directly wire them to that switch. vLANs to the rescue - you can have a switch at each rack and each clients servers connected at layer 2 without being able to affect other clients. Without vlans in such a setup malicious servers could try to steal ip addresses from another users server.
If gives you almost all the security of running several isolated networks without the pain and expense of managing them seperately.