In this paper, we introduce a Hidden Markov Model (HMM) for studying an optimal investment problem of an insurer when model uncertainty is present. More specifically, the financial price and insurance risk processes are modulated by a continuous-time, finite-state, hidden Markov chain. The states of the chain represent different modes of the model. The HMM approach is viewed as a 'dynamic' version of the Bayesian approach to model uncertainty. The optimal investment problem is formulated as a stochastic optimal control problem with partial observations. The innovations approach in the filtering theory is then used to transform the problem into one with complete observations. New robust filters of the chain and estimates of key parameters are derived. We discuss the optimal investment problem using the Hamilton-Jacobi-Bellman (HJB) dynamic programming approach and derive a closed-form solution in the case of an exponential utility and zero interest rate.