You can apply if you’ve been living in the UK for 5 years on a UK Ancestry visa.
Some Commonwealth citizens have ‘right of abode’ in the UK. This means you can live or work in the UK without immigration restrictions. Check if you can apply to prove you have right of abode in the UK.
You may be eligible for citizenship instead, for example by applying under the Windrush scheme.