Both of these words express regret for some problem or something you did wrong.
I'm sorry is less formal, and "I apologize" is more formal. There are a few different ways to continue the sentence. You can say:
I'm sorry (that) I yelled at you.
I'm sorry for yelling at you.
I apologize for yelling at you.
Don't make the common error of saying "I'm apologize." It's either "I'm sorry" or "I apologize."
The noun form for a statement like this is an apology. So if your boyfriend forgets your birthday and says he is sorry, you can then accept his apology. Here are more examples:
The politician apologized for his offensive comment, but some people are saying his apology was not very sincere.
The company issued an apology to its customers for the defective product.
When you accept somebody's apology and agree not to be angry at them anymore, you forgive the person.