It is almost never OK, legally or ethically, to release products that you have created using your employer's resources or while being payed by the employer for your time without permission.
However, it depends on your employment contract. If you were paid by the company and/or used company resources to produce the product, chances are that the work belongs to your company. You need to go through your supervisor and your legal department. Depending on your employment contract, there might also be restrictions on working on related technologies or using knowledge gained at your employer in projects, even if you work on them using personal resources on your own time.
If you are using paid time, company resources, or are developing something that might be considered related to the business of your company, always seek guidance from your manager and/or legal department to ensure that you aren't violating any agreements and to get the appropriate permission to work on projects. Typically, it's easier to do this before you begin work as it might change the approaches that you take on the project.
Writing products for the use at work on your own time is questionable and depends on the regulations that your employer must adhere to. At the very least, you could be interfering with your employers schedule, budget, and estimates by taking work off-line. In some cases, you could be violating the contractual regulations by creating products outside of time that is tracked and billed appropriately.
The Apache License is a permissive license. It basically lets you do pretty much anything you want, as long as you tell people you used the software, and that it was Apache Licensed.
[I]f part of my application uses code I did not write ... under the Apache 2.0 license, am I not allowed to charge for my app?
No, it is perfectly ok to charge for your app. The Apache license does not prevent you from charging for applications that use Apache Licensed code.
From the license:
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
There is no mention in those conditions about charging or not charging money.
Do I have to release the source to my entire project?
No. The conditions from the license do not mention any requirement to release source.
What am I allowed to do and not allowed to do?
From the conditions:
You must give any other recipients of the Work or Derivative Works a copy of this License; and
I.e. you must include the license file with your application. (For binary applications, most people put this in a "terms of service" menu or some such.)
You must cause any modified files to carry prominent notices stating that You changed the files; and
I.e. if you give someone the source, you must point out explicitly what was changed.
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
I.e. you cannot delete any license notices from the source package
*If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. *
I.e. if you have your own NOTICE file, you must include all license information from the original.
Other Licenses
Note that this applies to the Apache License. There is another very common license, the MIT license, that is functionally equivalent.
The other most common licenses are the GPL and the LGPL. Both of these licenses also let you charge money for applications generated, but different in that they both require you release source to users who you give binaries to, always for the GPL, under specific conditions for the LGPL.
Best Answer
Good question, but it's probably the wrong place to ask because you won't get good legal advice from programmers. IANAL, seek proper legal advice.
It doesn't feel legal. There's a very good chance that if you release an almost identical program to the one that your old company owns you could be sued. That said I'm sure it happens a lot.
One thing you could do is recreate the program in a different language. That way it's clear that you didn't walk out of the company with the source code & then open-source it. It's also educational to solve a problem you are familiar with in a different language.
I'd also suggest thinking about ways to improve the program, make it more extensible etc. The second time you do something is almost always a lot better than the first because you can avoid all of the "I wish I'd done it that way" design decisions that you may have made the first time.
Even if you never release it it would be a good exercise. If ultimately you get legal advice & choose to release it you will be better protected.