They're both actions that take place in the past but:
had (past simple): "I had lunch". It's something you did in the past and which is now over.
was having (past continuous): "I was having lunch". Still something you did in the past, but this time you wish to put the stress on the action itself, on the thing you were doing.
So you can say for instance "I was having lunch while the phone rang", but you cannot say "I had lunch when the phone rang", if you wish to say that the phone actually interrupted your action.