The history is disputed between the Rakhine and Rohingya, but in essence it is related to population movement between the Chittagong region (now south-eastern Bangladesh) and Arakan (now Rakhine state in Burma/Myanmar), and so whether the Rohingya should be seen as recent immigrants or as indigenous people. Most Rakhine, Burmese and Buddhists from other groups see the Rohingya as recent immigrants with little loyalty to the country, and so as perceived foreigners they are not included in the government's list of ethnic groups. You might compare this with the UK government's protection for the Scottish Gaelic language but not for the Polish language despite the latter being more commonly spoken in the UK. Wikipedia's article on the Rohingya gives some of the key issues and claims.
There was certainly substantial migration of the Rohingya to Arakan after both areas were controlled by the British from the early/mid 19th century to the middle of the 20th century. The Rohingya claim that they were in fact refugees from the earlier Burmese conquest of Arakan; the Rakhine believe they themselves were the victims of the Burmese and that this left space in Arakan for Rohingya immigration.
The Japanese conquest of Burma made thing worse: the Japanese armed some Rakhine against the British, but massacred some Rohingya and drove others to Chittagong. The Rakhine claim that at the end of the war the Rohingya then attacked Rakhine villages rather than fight the Japanese.
After WW2, as British India and British Burma headed towards independence, a large number of Rohingya called for Arakan to be included in the new country of Pakistan (essentially the Muslim-majority areas of north-east and north-west British India, with East Pakistan later becoming Bangladesh). Both the Rakhine and the Burmese saw this as an indication that the Rohingya were not loyal to where they lived. The Rohingya took a different view, claiming loyalty to what they they saw as their land, but not to the state it was about to be included in.
Like most of the minorities in independent Burma/Myanmar, the Rakhine saw themselves as being oppressed by the majority Burmese and by the military government. They felt doubly oppressed, because this combined with what they saw as the large and unjustified presence of Rohingya locally, and this has led to much of the communal violence and the increase in Rohingya refugees.