Direct and inverse problems for a nonlinear time fractional equation are studied. It is proved that the direct problem has a unique weak solution and the solution depends continuously on the nonlinear coefficient. Then it is shown that the inverse problem has a quasi-solution. The direct problem is solved by method of lines using an operator approach. A quasi-Newton optimization method is used for the numerical solution to the inverse problem. Tikhonov regularization is used to overcome the ill-posedness of the inverse problem. Numerical examples with noise free and noisy data illustrate applicability and accuracy of the proposed method to some extent.