Which thread runs first when checking with threadIdx.x?

Is it certain that threads will run in order of their order, ie from 0 to n-1 where n is no. of threads? Or they can take threadIdx.x value in any order?

The entire point of CUDA is that threads can run in parallel, which means there is no ordering between them.

If however your question is about how threads are assigned to warps, warps are indeed assigned consecutive threads.

You may want to (re-)read the sections on the CUDA programming model and it’s hardware implementation in the excellent CUDA C Programming Guide.