In essence, you have a relative clause, 'which...'. There are two forms of relative clause: the restrictive and non-restrictive. Non-restrictive clauses include information regarding a noun which is not directly necessary to the meaning of the noun - they do require commas. From reading this sentence, I believe this may be of the latter class.
You could construct your sentence like 'he was stopped at his locker, which of course, happened to be right beside mine'. An additional comma marks the adverbial phrase. Moreover, there does not appear to be subject-possessive agreement. You may mean to suggest 'he stopped at his locker...' otherwise the passive clause does not agree with the relative clause.
Best luck with our short story.