In this work, an intelligent mobile edge computing (MEC) network is studied for Internet of Things (IoT) in the presence of eavesdropping environments, where there are multiple users who can offload their confidential tasks to the computational access point (CAP) for the assistance of computation. One unmanned aerial vehicle (UAV) attacker exists in the system and it can listen to the confidential data transmission from the users to the CAP. We optimize the system design of the intelligent MEC network, by adaptively allocating the offloading ratio and wireless bandwidth, to reduce the linearly weighted cost of the latency as well as energy consumption (EnC). Specifically, starting from the deep reinforcement learning, we devise a deep Q-network (DQN) network to adjust the offloading ratio and transmission bandwidth, which can help calculate the computational tasks and suppress the eavesdropping from the UAV efficiently. We finally provide some simulation results to validate the proposed offloading strategy. In particular, the proposed offloading strategy can achieve a much lower cost compared to the conventional ones, in the terms of latency and EnC.INDEX TERMS Deep reinforcement learning, Internet of Things, mobile edge computing, task offloading, unmanned aerial vehicles.