It wasn't always written this way: in the earliest records of written Polish (such as the Bull of Gniezno), the letters "u" and "v" were used for this sound as well. There was no official "standard" for Polish orthography (or, for that matter, the Polish language) until the 18th century.
At this point, the letter "w" had already come to mean /v/ in German, due to a 17th-century phonological change ([w] → [β] → [v]). This is the same change which happened much earlier in Latin to separate "v" from "u" in the first place.
So when written Polish was finally standardized, many writers were using "w" for the /v/ sound due to influence from German. And it thus became part of the official orthography.