How can I use a neural network to solve nonlinear programming problems?

First of all, by minimizing the loss function using gradient descent (or other iterative methods) you are performing a non- linear optimization.

Secondly, yes neural networks of enough depth can approximate any function so solving non linear optimization problems (approximately) should be possible.

One key difference between optimization and machine learning is that functions learnt by machine learning algorithms ideally generalize to data points not seen by the algorithm during training.