It doesn't compete, they are for different applications.
PLCs are industrial devices that are extremely rugged. They operate in very harsh environments: very hot or cold, oily, high vibrations, etc. They need to operate 24/7/365 without fail.
A $5,000 microcomputer might seem like a lot, but when it's responsible for controlling a $100,000/hr production line it's a drop in the bucket.