As a native speaker, I also feel uncomfortable with 事故は先週に起こった, which can be said to be a little unnatural but probably cannot be said to be ungrammatical. 先週 plays the role of an adverb in this sentence, so its natural sentence will be:
But as a writer, I would like to avoid this, because I don't like the awkward sequence of Chinese characters of 先週 + 起. So I like this sentence transcribed like this with the use of punctuation marks.
- 事故は(、)先週、起こった。
- 先週、事故は起こった。(very natural to me)
This point might be trivial for other Japanese, but I am always wondering how to use this kind of noun phrase used as an adverb. In order to avoid this (discomfort), I prefer the following to the above sentence.
- 事故は先週のあいだに起こった。(a little longer, but very natural to me)
After answering this question, I hit upon the following sentence.
This sentence with に in it is, no doubt, grammatical and quite natural. I have no idea of the cause of the difference in naturalness and grammaticality between this and the above sentence (事故は先週に起こった).