Until the Middle Ages the letter W was simply a ligature of two letters V side by side. It was introduced to make a distinction between the sounds we know as 'v' and 'w' which was unnecessary in Latin.
W was first used by scribes writing Old English during the 7th century AD. At the same time, the Runic letter Wynn () was more commonly used to write the /w/ sound.
After the Norman Conquest the letter W became more popular. Around 1300 AD, W had finally replaced Wynn and was added to the Latin alphabet as a separate letter. It was used for sounds from the Germanic languages, not existing in medieval Latin.
Before the Renaissance, letters J and U had been merely glyph variants of I and V.
Only after the Renaissance did it become conventional to treat I and U as vowels, and J and V as consonants.
Letter J was officially set apart from I in the 16th century. It is believed to have first been used by Petrus Ramus.
U was differentiated from V occasionally, but this distinction only became standard after the 18th century.