In my master's thesis we deal with the optimal control problem, which we then apply to solving a bank crisis. Firstly, we get a general overview of types of optimal control problems. We learn that there are $4$ types of models, which are discrete time deterministic, continuous time deterministic, discrete time stochastic and continuous time stochastic models. We focus on the continuous time deterministic model and state Pontryagin principle. We prove the existence theorem by using a minimizing sequence of the state functions. Then we develop a tool for finding the optimal control via dynamic programming. The main result there is obtaining the equation of dynamic programming. We get familiar with the notion of feedback control and solve one example with the help of Pontryagin principle. Our last chapter focuses on modelling a bank crisis into optimal control problem by using the SIR model. We have three different examples of crisis propagation. The first crisis starts with a bank in Portugal, the second one with a bank in Spain and the third one starts in Great Britain. The crisis spreads quickly in Portugal and Spain but also ends relatively soon whereas in Great Britain it takes a lot more time for the crisis to spread but it lasts a lot longer, which is what we are afraid of. We then propose a control function with some restrains to end the crisis more quickly and prevent it from spreading. We model and solve these situations in Matlab.