There are some tools which can help work out which program is getting the focus, which might provide a clue as to why it's happening.
This one looks nice and simple, and also has source-code which is reassuring:
(Found via How to detect a background program (in Windows 7) which steals active focus automatically? - Super User which has some alternative suggestions as well.)