Most people will tell you borrowing from a 401k is a bad idea, because in the long run, you are probably losing out on the compounded interest you could be earning over time.
But honestly, if you are in a dire financial position, I still think it's better to borrow from yourself than getting a loan elsewhere...
The bigger concern, for me, is if you lose your job, you will be required to repay the full loan almost immediately. If you can't, you will have to deal with paying taxes/ penalties.
So I understand why people think 401k loans are a bad idea, but if you are experiencing a hardship, do what you have to do!