In 1920 the Government of Ireland Act 1920 was voted by Westminster and came into effect in 1921. It divided Ireland into two autonomous regions.
The region of Southern Ireland eventually became the Irish Republic.
The region of Northern Ireland remained an autonomous region of the UK until 1972 when the arrangement was first prorogued and then suspended under the Northern Ireland Constitution Act 1973. To put it simply, in 1972 Northern Ireland came under more direct British rule as a response to the Conflict that had recently erupted.
So, what happens now?
the Flag Regulations (Northern Ireland) 2000 forbids the flying of any flag on government buildings other than