Long story short: Turkey repressed its Kurdish population into terrorism/violent separatism, so a terrorist faction called the PKK has been fighting in southeastern Turkey for Kurdish autonomy for several decades now.
The YPG is a Kurdish faction in northern Syria that fights against ISIS, and according to Erdoğan (or Turkey in general, really), it and the PKK are one and the same, so Erdoğan is invading on the pretext that Turkey is eradicating PKK-related soldiers in northern Syria for its own security and integrity.
Erdoğan also wants to settle some 2 million Syrian refugees in the area, but that's relatively sensible (Turkey doesn't have the infrastructure or economy to support the 3 million odd refugees it has right now, and racist tensions are high). (Of course it'd probably constitute ethnic cleansing anyhow but yeah.)
Also, i might be biased because I grew up in Turkey and am most familiar with that viewpoint.