An idiom is a phrase in the sense that it is conveying some information, but a phrase is not necessarily an idiom.
Specifically, an idiom explains something indirectly through some kind of underlying meaning.
* Rakesh rang the doorbell - this is a phrase, which conveys the information that Rakesh rang the doorbell of a house.
* The name Pritam rang a bell in Rakesh's mind - this is an idiom, meaning that Rakesh vaguely recollected somebody by the name of Pritam. It does not literally mean that Pritam entered Rakesh's mind and rang a bell inside!