You need some lockpics, first... then, go to inventory, drag them to the hand, and click on the thing you want to lockpick. If Virgil's lockpicking score is higher than yours, he'll interrupt and take over.
Virgil's lock picking skills are so pitiful as to be useless. Even if you give him a skeleton key he rarely succeeds. Sebastian does far better as does the unlocking cantrip spell.