John 18:10 (NLT)
10 Then Simon Peter drew a sword and slashed off the right ear of Malchus, the high priest’s slave.
The pastor at a church I used to go to once said1 that Peter was part of a militant sect of Judaism that felt like it was their duty to kill Roman soldiers as often as possible/prudent. This would explain why Peter had the sword with him and why his first instinct was to attack. However, I don't know either the name of this sect or whether he was involved in one.
1: If absolutely needed, I can dig up the sermon transcript online.