The origins of the YPG ("People's Protection Units") are closely associated with the Democratic Union Party (PYD), a parliamentary opposition party founded in 2003. Almost immediately, but especially after an ethnic riot in 2004, the PYD faced violent repression and harassment from the Syrian regime. It seems that the YPG (or at least some more rudimentary militia organization connected to the PYD) took shape around this time. In that context, the primary objective of the YPG would have been to resist government repression, but it's unclear to me whether they actually did so in any direct and active way.
In the summer of 2012, there were direct clashes between Kurdish militias and regime forces. The regime began to withdraw from the area, the YPG publicly announced its existence to the international media, and it began to claim territory under its control. Clashes continued, but mainly with competing rebel groups (especially Salafists) and soon after with ISIS. So the start of the Syrian Civil War was a major turning point.
While Kurdish militias in general and the YPG in particular began fighting the regime, there stance has always been relatively moderate compared to most of the rebel coalitions that emerged in 2011-2012. As the regime became weaker, and the YPG had an opportunity to assert Kurdish autonomy. The immediate threats they were facing quickly changed. Now their immediate objectives are to confront ISIS and hostile rebel factions.
Long-term, it is difficult to say how the YPG will evolve. This will especially depend on the outcome of the Syrian Civil War. Ideally, I'm sure many of their supporters would be very happy to see a united and independent Kurdistan, but they are not explicitly fighting for this as far as I can tell.