Sometimes 不好意思 can also mean “embarrassed”, “ashamed”.
It can be used either in a set expression:
Or as an adverbial modifier: “to do something shyly”. Sometimes we can also use the particle 地 after 不好意思 and before the following verb denoting action.
She replied shyly
tā bù hǎoyìsi de huídá
I'm embarrassed to say I lied to her
wǒ zhēn bù hǎoyìsi shuō wǒ xiàng tā sā le huǎng
We use 对不起 in a more formal way. It can be used either in colloquial speech or written language. However the emotional coloring is stronger and the speaker feels more guilty:
Sorry, I lost my temper
duìbuqǐ, wǒ shītài le
Sorry, it was my fault
duìbuqǐ, shì wǒ cuò le
We can use adverbs of degree before 对不起 and 不好意思:
很 实在 真 非常
I'm really sorry, I forgot about your birthday
zhēn duìbuqǐ, wǒ wàng le nǐ de shēngrì le
To sum it up:
不好意思 is used in colloquial speech. We use it to apologize for a small fault or to express embarrassment.
对不起 is used both in colloquial speech and in writing. We use it to apologize for small faults or for more serious mistakes.