This reaction is an SN2 reaction. The cleavage of ethers by halogen acids occurs by the following mechanism.
Step 1: Ethers being Lewis acids, undergo protonation to form oxonium ions.

This reaction takes place with HBr or HI because they are sufficiently acidic.
Step 2: Iodide ion is a good nucleophile. Due to steric hindrance, it attacks the smaller alkyl group of oxonium ion formed in step 1 and displaces the alcohol molecule by SN2 mechanism as shown below:

Step 3: when excess HI is used, ethanol formed reacts with another molecule of HI to form ethyl iodide.
